Hi,
Specifically, stack traces are printed as multi lined log messages where
each line is pre-appended with the timestamp, module name etc which
makes the log files less readable. This is because the code uses the
printStackTrace method on the exception instead of logging to a logger.
Since we redirect standard out and standard error to a logger the
messages end up in the log file but it is formated as multi lines.
To print a stack trace as a single line message where only the first
line has the timestamp, module name etc, stack traces need to be printed
using a logger. For example, the code below uses an anonymous logger
(in case you don't have a logger already) and passes the exception
object (ex) and the formating code we use will print it correctly. Each
developer needs to determine the correct level for the message and
remember that all SEVERE (and soon WARNING) messages need diagnostic
information.
Logger.getAnonymousLogger().log(Level.SEVERE, "Error occurred", ex);
I searched the workspace and there are around 800 uses of
printStackTrace in the code (I tried to exclude the tests directories).
We would like developers to go through their code and replace the
existing code with a line as the one above by August 17.
Please see the wiki page below which lists the modules that need to be
updated.
http://wiki.glassfish.java.net/Wiki.jsp?page=GlassFishV3LoggingCleanerMessages
Thanks,
Carla