Feature #4565
closedenable configuration of java.util.logging
0%
Updated by Reynaud Sylvain about 12 years ago
Do not use JSW's wrapper.conf file, use system property "java.util.logging.config.file" instead.
Check that this does not prevent from modifying logs configuration through JMX.
Updated by Schwarz Lionel almost 12 years ago
- Status changed from New to Suspended
- Assigned To set to Schwarz Lionel
Unable to make this work properly. There is an issue using hierarchical structure for logger name in the configuration file when it is loaded at run time.
Example of configuration file:
# --- Default level (overridden by handlers and loggers level) --- .level = WARNING handlers = java.util.logging.ConsoleHandler # --- ConsoleHandler --- java.util.logging.ConsoleHandler.level = FINE java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter # --- Loggers level --- fr.in2p3.lavoisier.service.level = FINE
If the file is loaded at JVM start with -Djava.util.logging.config.file=xxx
, the Logger fr.in2p3.lavoisier.service.resources.LavoisierHttpHandler
properly prints FINE level logs:
[...] 29 août 2013 10:23:38 fr.in2p3.lavoisier.service.resources.LavoisierHttpHandler service FIN: Authz=null 29 août 2013 10:23:38 fr.in2p3.lavoisier.service.resources.LavoisierHttpHandler service FIN: RemoteUser=null [...]
If it's loaded at run-time with the following code:
InputStream stream = Server.class.getResourceAsStream("/" + properties.getString(ServerProperty.LAVOISIER_LOGGING_FILE)); try { LogManager.getLogManager().readConfiguration(stream); } catch (Exception e) { e.printStackTrace(); }
The Logger fr.in2p3.lavoisier.service.resources.LavoisierHttpHandler
does not print any logs.
But the Logger works fine when the full class name is used:
fr.in2p3.lavoisier.service.resources.LavoisierHttpHandler.level = FINE
The issue was reproduced in JDK6 and JDK7.
Using the property <logger>.useParentHandlers
described at http://docs.oracle.com/javase/6/docs/api/java/util/logging/LogManager.html did not help.
Updated by Schwarz Lionel almost 12 years ago
There are two ways of modifying the logs configuration:
- modify the standard configuration file named at
${java.home}/lib/logging.properties
This configuration file will be used for every java programs run in this JRE. - specify another configuration file at startup using the property named
java.util.logging.config.file
Updated by Schwarz Lionel almost 12 years ago
- Status changed from Suspended to Resolved
fixed by adding the -D option in the lavoisier-package/pom.xml