I created a dynamic web project using IBM Rational Application Developer (RAD). I used java.util.logging as the logging framework. I put the logging.properties in WEB-INF/classes directly.
The problem which I am facing is, the application could not load the logging.properties even I put it in the WEB-INF/classes. I add the following generic JVM arguments in the WebSphere Application Server Administrator's Console
-Djava.util.logging.config.file="logging.properties"
I add the following code snippet in the servlet init method.
Properties prop = System.getProperties();
prop.setProperty("java.util.logging.config.file", "logging.properties");
System.out.println("Is file exists " + file.exists());
try {
LogManager.getLogManager().readConfiguration();
} catch (IOException ex) {
ex.printStackTrace();
}
I off the console level debug in logging.properties, so I should not get the logging in console. But currently I am getting the logs in console not in log files which I mentioned in logging.properits.
logging.properties
#------------------------------------------
# Handlers
#-----------------------------------------
handlers=java.util.logging.ConsoleHandler,java.util.logging.FileHandler
# Default global logging level
.level=ALL
# ConsoleHandler
java.util.logging.ConsoleHandler.level=OFF
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
# FileHandler
java.util.logging.FileHandler.level=FINE
# Naming style for the output file:
java.util.logging.FileHandler.pattern=${SERVER_LOG_ROOT}/nyllogs/loadData.log
# Name of the character set encoding to use
java.util.logging.FileHandler.encoding=UTF8
# Limiting size of output file in bytes:
java.util.logging.FileHandler.limit=25000000
# Number of output files to cycle through
java.util.logging.FileHandler.count=2
# Style of output (Simple or XML):
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
Please let me know why the application couldnt pick up the logging.properties file?