dev@glassfish.java.net

patches to fix format of messages in server log

From: Dies Koper <diesk_at_fast.au.fujitsu.com>
Date: Mon, 2 Feb 2009 13:34:47 +1100

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.

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.

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?

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.

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).

Thanks,
Dies Koper