Do you not mean "l18n"?

"Johnson, Clay" wrote:
> 
> Folks,
> 
> I have a requirement to defer l10n processing to appenders, rather than at
> the publisher of the log event, in order that different appenders may
> localize the same event according to different locales.  Since the l10n
> methods in Category rely on preregistered ResourceBundles, that doesn't
> work. Furthermore, with only a cursory look at the internals, it appears
> log4j converts the message Object to a String to construct a LoggingEvent
> *prior* to distributing that to all appenders.  If that is true, I worry
> whether my requirement can be met without substantial
> modification/extension.
> 
> One approach is to marshall my ResourceBundle name, key, and replaceables
> into a string, and then implement my own Appender that unpacks these,
> localizes according to *its* Locale (determined at construction), and then
> proceeds to log the localized String.  The immediate concern with this
> approach is apparent forfeiture of all existing Appender functionality that
> I otherwise want to leverage, as well as Layout processing, since I would
> have co-opted it to marshall my Object.
> 
> Please tell me there's a simpler way to do this that doesn't up-end the
> framework.

You should be OK. Just don't use the String which has already been
constructed or  else use it a as a key into the resource bundles (like
Category does). Judging from what you're saying you're planning on
passing in non-Strng object which you'll use in Appenders/Layouts to
create localized log messages in some way.  The LoggingEvent now
contains the original Object *in addition* to the String version of same
Object so you can just use the Object.

> 
> Thanks,
> Clay

--
Anders Kristensen

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to