You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Colin MacDonald <co...@templarcorp.com> on 2002/06/05 15:58:13 UTC

I18n via Renderer

So, what's the normal way of setting up log4j to display locale-specific
messages?  I've messed around a bit with creating a Renderer to do it, but I
haven't been able to get that to work.

The idea was to have a custom Renderer for java.lang.String, so you could
have a normal logger call like:
    debugLog.error( "Something has gone wrong here" );
The Renderer class would take the message string and use it as a key for a
ResourceBundle.  You could have a debugMessages_de.properties file with an
entry like:
    Something has gone wrong here=Etwas ist los
(Sorry if that's wrong - my German is pretty minimal)
and the Renderer would spit out the translated message string.

I'm not sure if this approach is clever or grotesquely hackish.  ;)

I added a line to my log4j.properties file like:
    log4j.renderer.java.lang.String=my.RendererClass
The renderer is getting loaded and instantiated, but its doRender(Object)
method is never getting called.

Any ideas?  Thanks!

-----------------------------------------------------------------
Colin MacDonald  |  Software Developer  |  Templar Corporation  |
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.368 / Virus Database: 204 - Release Date: 5/29/2002


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>