dev@glassfish.java.net

Re: logging messages in GlassFish

From: Carla Mott <carla.mott_at_oracle.com>
Date: Fri, 07 May 2010 12:29:09 -0700

Not sure what you are asking. We have not changed the usage of logging
in 3.1 from 3.0. I wanted to remind folks that as they are adding code
for 3.1 they need to add message ids to their existing messages if
missing, new messages (SEVERE, WARNING and INFO) must have a message id
and those messages should be in a resource bundle called
LogStrings.properties.

There are of course exceptions to this. If you are working on code that
is third party and that code uses a different name for the resource
bundle then you don't have to change it. Also messages that are
displayed in the CLI messages or any exception messages will be located
in a file called LocalStrings.properties. A utility called
StringsManager is used to get the localized version of the message. A
message id is not required for messages in the LocalStrings.properties
file. [in fact there should not be one because it will never be found
by tools and it will not appear on the docs that the doc team creates]

hth,
Carla

Byron Nevins wrote:
> Where are the exact instructions on how to setup and use this facility?
>
>
> On 5/4/2010 5:44 PM, Carla Mott wrote:
>> Hi all,
>>
>> We are getting started with the 3.1 code and I wanted to send out a
>> note about logging messages in GlassFish. This should be review and
>> I wanted to make sure we all use the GlassFish logging mechanism as
>> it was intended.
>>
>> Thanks,
>> Carla
>>
>> Review of the requirements:
>>
>> As of the 3.0 release ALL messages of level SEVERE, WARNING and INFO
>> must have a message id. That is all messages in the
>> LogStrings.properties file must have a message id. Please see the
>> following wiki page for information on message ids.
>> http://wiki.glassfish.java.net/Wiki.jsp?page=GlassFishV3LoggingMessageFormat
>>
>>
>> Log messages level SEVERE, WARNING and INFO should be in
>> LogStrings.properties file
>>
>> All SEVERE and WARNING messages must have dignostic 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:
>> _logger.log(Level.SEVERE, "jacc_policy_context_exception", cause);
>>
>>
>> Example LogString.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
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>>
>