I don't think this alternative has been proposed, the additional features could also be provided by a decorator, something like :

ExtendedLog log = new ExtendedLog(LogFactory.getLog(Foo.class));

or

ExtendedLog log = LogFactory.getExtendedLog(Foo.class));


For localization, ExtendedLog would create a LogMessage and pass it to the log implementation. It could also add a code guard to reduce object creations:


    public void debug(String key, Object[] params) {
        if (log.isDebugEnabled()) {
            log.debug(new LogMessage(key, params));
        }
    }

For log implementations supporting i18n, the key is extracted from the LogMessage and searched in a resource bundle. For other implementations, LogMessage.toString() returns the key and the parameters concatenated.

Just some thoughts :) For i18n I think I like Curt's solution of parsing the message in the implementation.

Emmanuel Bourg


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



Reply via email to