I have two handlers in my logging.properties:
handlers = java.util.logging.FileHandler, java.util.logging.ConsoleHandler
Both use the SimpleFormatter
:
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
But now I want two different formats for these handlers. The console handler should print only a short message. The file handler on the other hand should print a more detailed message. But how to use different formats for both formatters? The following did not work:
java.util.logging.FileHandler.formatter.format = ...
And using
java.util.logging.SimpleFormatter.format
below the corresonding formatters did not work either. Any ideas? I don't want to implement own formatters just as a workaround...