dev@glassfish.java.net

Re: logger printing message param twice

From: Byron Nevins <Byron.Nevins_at_Sun.COM>
Date: Fri, 23 Feb 2007 11:20:55 -0800

I've never heard of this behavior -- and I write lots of similar
messages. If the String is in LocalStrings.properties in the class'
package -- then I would do this:

import com.sun.enterprise.util.LocalStringsImpl;

yourCode()
{
        LocalStringsImpl stringy = new LocalStringsImpl();
        String s = stringy.get("some_key", someObject);
        logger.log(SEVERE, s);
}
Now you at least have a chance of figuring it out via a debugger...


Bobby Bissett - Javasoft wrote:
> I have code that is logging a Level.SEVERE message as so:
>
> logger.log(Level.SEVERE, "some_key", someObject);
>
> With log string:
>
> some_key=My message {0}
>
> In the log output, I'm seeing the someObject.toString() text twice,
> once before "My message" and once again after. Is this by design? It
> creates too much output this way (the object is an expired cert and it
> prints ~25 lines).
>
> I see in UniformLogFormatter.uniformLogFormat() it calls
> getNameValuePairs() before appending the message and object, and
> getNameValuePairs() appends someObject.toString() before returning so
> that the same information is in the log message twice.
>
> Can someone tell me if this is a bug? If not, is there a different way
> to call the logger so I don't generate this much output? I would like
> to give as much information as possible in this message (it's SEVERE),
> but I don't want to give it twice.
>
> Thanks,
> Bobby
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>