logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benoit Voisin <benoit.voi...@ergoidp.dk>
Subject RE: Internationalization/ResourceBundles in messages?
Date Fri, 14 Jun 2002 08:30:55 GMT
I have also done a Internationalization but a display time one : only the
message code and the parameters are stored in the log file or DB and the
external process reading this info can use it´s own ResourceBundles to
localize the message.

We use it because the same log needs to be readable in different
languages(local language for the operator, and in english for us) and that
each message can have extra explanation(troubleshooting, ...).

It uses the category name as the messagecode, and the message as the
parameters. This means that you have one Logger object by message code. It
could also have been possible to use a special LoggingEvent object
containing the two, but the first solution offers more liberty.

Unfortunately, it uses loads of memory because you need one Logger object
per messagecode, but for us this memory/initialisation issue was not a

Another problem we faced was that the messages codes had to be stored in
different places:
 - the Log4J config, containing the list of Loggers (one per messagecode)
 - the Java interfaces enumerating the different Loggers (for easy
 - the resource bundles (containing the localized texts)

We needed that to be synchronized, so we made a few XSLT generating them
from a list of messagecodes (code, Java name to identify it in the Java
interfaces, Level to which they should be logged, message text in various

The developper then just have to call
and the implementation will generate the correct logging event, at the
correct level, ...

The main problem is that currently it uses a Sub Class of Logger, which is
not very nice (I think Ceki has said enought about it). A future version
will use a different object.

It is just in Beta now, but if it interests you, just email me,

To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

View raw message