New logging formatter for Grizzly
I created a new logging formatter for Grizzly, because when we were debugging a test we weren't able to trace in the log the event because the default formatter in java.util.logging doesn't print the Thread that log the event. (ouff.. that a long line)
The new formatter is : com.sun.grizzly.util.LoggingFormatter
It's based on java.util.logging.SimpleFormatter.
It's really simple to change the formatter used by java.util.logging API.
You will have to create a file logging.properties (can be any name) and add this parameter to the command line.
-Djava.util.logging.config.file=logging.properties
There is already a file name logging.properties that came with the JRE. (jre/lib/logging.properties). You can take this file as sample for your application.
With these file, you will have only one line to change to use the new logging formatter.
* #the default logger is this add you can replace it with LoggingFormatter
* #java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
* java.util.logging.ConsoleHandler.formatter = com.sun.grizzly.util.LoggingFormatter
An example of the output will look like that :
[WorkerThreadImpl-1, Grizzly] 2008-10-08 18:49:59 [INFO] com.sun.grizzly.Controller:doSelect message
- Login or register to post comments
- Printer-friendly version
- survivant's blog
- 906 reads





