dev@glassfish.java.net

Logging messages in GlassFish v3.1

From: Naman Mehta <Naman.Mehta_at_Sun.COM>
Date: Wed, 26 May 2010 12:35:32 +0530

Hi all,

We are getting started with the 3.1 code and I wanted to send out a note
about logging messages in GlassFish v3.1.

I wanted to make sure we all use the GlassFish logging mechanism as it
was intended. We have not changed the usage of logging in 3.1 from 3.0.

*
Specific Requirements for 3.1:*
1. ALL messages of level SEVERE, WARNING and INFO must have a message
id. Log messages level SEVERE, WARNING and INFO should be in
LogStrings.properties file. All messages in the LogStrings.properties
file must have a message id. Please see the wiki page for information on
message ids:
http://wiki.glassfish.java.net/Wiki.jsp?page=GlassFishV3LoggingMessageFormat
.

2. All SEVERE and WARNING messages must have diagnostic info too. Below
is an example I got from the EJB module. It shows the code and the
entries in the the LogStrings.properties file.


*Example code from EJB module: *
1. Java File entry:
    Logger _logger = LogDomains.getLogger(EJBSecurityManager.class,
LogDomains.EJB_LOGGER);
    _logger.log(Level.SEVERE, "jacc_policy_context_exception", cause);

2. LogStrings.properties file entry:
    jacc_policy_context_exception=EJB5183:JACC: Unexpected exception
manipulating policy context
    EJB5183.diag.cause.1=An Exception was thrown while resetting the
policycontext
    EJB5183.diag.check.1=Check the EJB policy to see if the policy
contexts of the application are correct

*
Right now I am creating defects for following:*
1. Missing message Ids in LogStrings.properties file.
2. Unused message Keys from LogStrings.properties file.
3. Hard-coded messages in Java file for Logging.

I have the script for verifying logging messages. Planning to integrate
the same in quicklook. Let you know on this.

If you have any question please let me know.

Regards,
Naman