[slf4j-user] slf4j-log4j12 LoggerAdapter.log() doesn't format the message with passed in parameters before displaying it

Toli Kuznets toli at marketcetera.com
Sat Dec 18 00:24:38 CET 2010


Hi,

This is likely a user error and/or misunderstanding, so apologies in advance.

I'm trying to port our code to the new 1.6.1 framework which changed
some LocationAwareLogger APIs.

In my SFL4J wrapper, i'm now calling through via the following method:

        ((LocationAwareLogger)logger).log(null,proxy,level,message,params,throwable);
the underlying logger API is:
Log4JLoggerAdapter.log, line 579 in 1.6.1
(https://github.com/ceki/slf4j/blob/master/slf4j-log4j12/src/main/java/org/slf4j/impl/Log4jLoggerAdapter.java#L579)
  public void log(Marker marker, String callerFQCN, int level, String msg,
      Object[] argArray, Throwable t) {

However, i notice that the incoming argArray is never "processed" in
that function, unlike al the error()  or debug() functions were
      FormattingTuple ft = MessageFormatter.arrayFormat(format, argArray);
is called first before the message is printed .

In the Log4jLoggerAdapter.log() method the incoming message is coming
through without having the arguments applied to it.

Is that by design? should i be calling a different method? or is it a bug?

This same setup worked in 1.5.8 prior to 1.6.1

thanks


More information about the slf4j-user mailing list