I want to add some log.debug statements to a class I'm working on, and I'd like to see that in output when running the test. I'd like to override the log4j properties on the command line, with something like this:
-Dlog4j.logger.com.mypackage.Thingie=DEBUG
I do this kind of thing frequently. I am specifically only interested in a way to pass this on the command line. I know how to do it with a config file, and that doesn't suit my workflow.
These answers actually dissuaded me from trying the simplest possible thing! Simply specify a threshold for an appender (say, "console") in your
log4j.configuration
like so:Then, on the command line, include the system property
-Dlog4j.info -Dmy.logging.threshold=INFO
. I assume that any other property can be parameterized in this way, but this is the easiest way to raise or lower the logging level globally.