30 August 2018

Glassfish console log timestamps

By default glassfish does not add timestamps to console logging messages and that allways leaves me wondering wether I'm looking at an old message or a new one.
To add timestamps edit $GLASSFISH_INSTALL/glassfish/domains/domain1/config/logging.properties
Replace domain1 with the domain your domainin the above,  if you are not using the default domain.
change:
java.util.logging.ConsoleHandler.formatter=com.sun.enterprise.server.logging.UniformLogFormatter
to:
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter

The default format is fine for me, but you can customize the format using:
java.util.logging.SimpleFormatter.format="your %format string"

The javadoc contains some format string examples.
Then (re)start the server.

No comments:

Post a Comment