I'm unable to adjust java logging's logging level. I'm using maven surefire (mvn test), and trying to adjust from the default INFO to e.g. FINEST.
I have logging.properties file under src/test/resources/logging.properties
after compile, i see under target/test-classes, i see a logging.properties file with the intended config:
java.util.logging.ConsoleHandler.level=FINEST
javax.enterprise.system.container.ejb.level=FINE
...
however the console output from glassfish only have INFO / SEVERE level messages.
Where did I go wrong? or is this another pain in the butt thing with maven?
I tried setting java.util.logging.config.file in the MAVEN_OPTS environment variable, which does not work but finally got it working by putting that system property in the pom.xml (and of course creating an appropriate logging.properties in src/test/resources):
I was looking at this exact issue, but did not want a project configuration (pom.xml) file change for every time I need specific logging on a test.
The -D property works from maven command line.
Thus you can select the logging configuration file from the command line:
If you are using the generic level denominator
.level=FINEST
be aware that 3rd party logging will also appear at that level.To disable or set the maven or 3rd party logging to a specific level use explicit log level selection for those classes in the selected log configuration file.
I have a lot of log lines from com.google.inject.....
So I add:
to the file. Remember that the level setting is recursive to all subclasses. Thus
com.level=NONE
will disable all logging for all loggers from thecom
domain.Combining this with the test select feature
-Dtest=...
in the surefire plugin described here is very good for isolating bugs and errors.try
Also, I specify this stuff on the command line with surfire-args.
You need to specifiy your handlers in the logging file
then it should work