As others have reported in years past, the examples in the docs for

Programmatically Modifying the Current Configuration after Initialization

are out of date.  They don't compile.  They don't work (affect the
existing logging) even if you do fix the errors.

Here's my situation:

I am working in an environment with EVIL.JAR which includes a log4j2.xml file.
I can't change the jar.  I can't specific a System Property to override it.

My code gets called as a loaded module long after the logging system
is initialized.

I want logging in my own code to go to a different location, and
preferably I'd like to read the configuration in from a log4j2.xml
file so that anyone who uses my module isn't victim to the same evil
hardcoded-logging practices of EVIL.JAR.

Creating an XMLConfiguration and initializing it lets me read the xml
file easily enough.   Looping through the data gets me the Appenders,
Filters and Loggers.   But I still can't use them to modify the
existing configuration.

Another person took the approach of using JUL instead.  I hate JUL and
I'd really rather not have to go down that route.

Thanks in advance.
-Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to