... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)


JDK Logging

If I had a dollar for every time I've looked this up...

To configure JDK logging, you can either edit the file JAVA_HOME/lib/logging.properties, or you can define the system property java.util.logging.config.file to point to another file.  The file looks like this:

handlers = java.util.logging.ConsoleHandler,java.util.logging.FileHandler

java.util.logging.ConsoleHandler.level = FINEST
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

java.util.logging.FileHandler.pattern = %h/java%u.log
java.util.logging.FileHandler.limit = 50000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter

.level = INFO
org.hibernate.SQL.level = FINE
org.hibernate.type.level = FINEST

The level specification in bold is a common gotcha - it limits the level of the messages that are shown on the console.  The levels are: FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE (and OFF).  More details can found in the javadoc for java.util.logging.LogManager.

Blog Archive