logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From manishmotw...@yahoo.com
Subject LocalizedLogger (enhancement)
Date Wed, 01 Jul 2009 19:02:11 GMT
I've written an enhancement to the localization support the generic Logger class provides.

A new LocalizedLogger overrides basic log4j logging methods (trace(), debug(), info(), warn(),
error(), fatal()) to use a localization mechanism. Instead of the actual log messages, keys
to localization log messages can be passed into these logging methods. Full parameterization
is supported. If keys are not found in the ResourceBundle, they are logged directly, skipping
the localization.

Internally, LocalizedLogger simply calls the l7dlog() method that already exists in Logger.
LocalizedLogger is just a convenience class for applications that don't want to call this
special method. 

A LocalizationResourceBundle and a LocalizedLoggerFactory classes are also included. These
helper classes provide easy integration with your application by simply changing the loggerFactory
defined in the log4j configuration to point to this new LocalizedLoggerFactory.

I've attached an SVN diff that can be applied to log4j trunk.



View raw message