GlassFish Community,
We've made some progress on converting from using the printStackTrace
method to using a logger to output a stack trace but we still have a
ways to go.
If you would like to contribute to GlassFish this is a great way to get
started.
Look at the wiki [1] as I recently updated it with the latest numbers
and have added information about tests where I could.
As indicated below log messages need to have a level associated with
them. Work with the module owners to determine the correct level or
post to this alias. All changes to the codebase require a contributor's
agreement [2].
[1]
http://wiki.glassfish.java.net/Wiki.jsp?page=GlassFishV3LoggingCleanerMessages
[2]
https://glassfish.dev.java.net/public/GovernancePolicy.html#SCA_Policy
Thanks for you help.
Carla
Carla Mott wrote:
>
> 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
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>