I have a situation where I can't have a configuration file, so I want to
configure Log4J programmatically.
The FAQ on this "How do I configure log4j2 in code without a configuration
file?<http://logging.apache.org/log4j/2.x/faq.html#config_from_code>" is rather
unclear, as it suggests using a method that takes a file name.
Shouldn't it suggest the one that takes a ConfigurationSource?
I recently found this:
InputStream is = MyLogFactory.class.getResourceAsStream("log4j2.xml");
ConfigurationSource source = new ConfigurationSource(is);
Configurator.initialize(MyLogFactory.class.getClassLoader(), source);
Is this the proper technique to use in this case?
________________________________
Confidentiality notice: This message may contain confidential information. It
is intended only for the person to whom it is addressed. If you are not that
person, you should not use this message. We request that you notify us by
replying to this message, and then delete all copies including any contained in
your reply. Thank you.