dev@glassfish.java.net

Re: patches to fix format of messages in server log

From: Ken Cavanaugh <Ken.Cavanaugh_at_Sun.COM>
Date: Sun, 01 Feb 2009 20:13:57 -0800

On Feb 1, 2009, at 6:34 PM, Dies Koper wrote:

> Hi,
>
> We've noticed a number of what we think are issues with some of the
> messages logged to server.log.
> I'd like to provide patches to fix them, but before I do that I'd like
> to confirm that you agree they are indeed issues and would be
> interested
> in fixing them.
> (If the rules for GF messages have been written down or discussed
> somewhere, I'll read it first. I'd be grateful for a link!)
>
> 1. Some messages are not defined or defined in the wrong log file,
> leading to the message key to be logged instead.
> -> I'm sure you'll be interested in these issues? Some of my patches
> for such issues have already been accepted.

Yes, these certainly should be fixed. For the ORB, I generate the
resource bundles
from a Scheme source file, so there can never be any missing entries.
But that's not the case everywhere.

>
>
> 2. Some parameters included in messages include arguments but they are
> not substituted correctly. (leading to {0} in messages)
> -> I'm sure you'll be interested in these issues too? Some of my
> patches for such issues have already been accepted.

You've found a few of these that crept into the ORB files. I don't have
enough checking for message format in the generation process.


>
>
> 3. Some messages have an ID (WEB7000, etc.), some don't.
> We think it is useful for messages to have an ID for the following
> reasons:
> - When looking in the log file, it makes it easier to see which
> messages are logged by GF and which by the application.
> - It is easier to communicate with others (colleagues in the next
> cubicle, on the phone, etc.) when discussing an error message when it
> has a simple ID.
> - It makes it easier to google an issue (if you copy & paste the whole
> message you might unintentionally include its parameters, reducing
> the hits)
> - It makes it easier to analyze the log file, monitor it and watch for
> certain messages using an external tool.
> -> Are there any rules or guidelines on this?

There were around 5 years ago, when the person then working on logging
helped to establish the conventions. I'm not sure if I can find a
copy of the
document (probably written by Hemanth Puttaswamy, who is no longer at
Sun),
but it's probably available somewhere, possibly on one of the internal
to Sun
pre-GlassFish servers.

>
>
> 4. Most messages that are logged with an ID, are logged with a format
> 'XXXnnnn: MSG', where XXX is an ID indicating the component where the
> message is logged, and nnnn a number. Some messages however don't
> follow
> this layout. I've seen ID like 'RAR 1000:' (whitespace in ID),
> '"DPL8012:' (double quotes around the whole message), or none, one or
> more spaces before and after the ':' separating the message from the
> ID.


All log messages are supposed to have a XXXnnnn identifier. Again,
this is
something that has probably not been uniformly reviewed as GlassFish
has evolved.
I think the original standard was (if I remember correctly) XXXnnnnn
(5 digits), but
the ORB uses IOPnnnnnnn because CORBA has a rather large space of
errors,
structured according to OMG standard or Sun, specific module, and
other information.
This may be aligned with a broader Sun standard for error message
identifiers, but
I don't remember the details.

>
>
> 5. Typos in messages. In most cases it is not difficult to understand
> what is meant. It just looks bad. I use Eclipse as IDE and it has a
> spell checker built-in, so it is easy to see where the spelling
> mistakes
> are (they are underlined in red).
>

Keep the patches coming! This is a pretty low overhead way to clean
up the
product, in ways that support anyone writing tools to scan log files.

Thanks,

Ken.