[logback-user] Configuring for detailed information on trace level, for entry and exit extensions

Ceki Gülcü ceki at qos.ch
Thu Jun 13 15:23:04 CEST 2013


Hi Mads,

The character is output '?' by %class (or %C), %method (or %M), %line 
(or %L) if caller information could not be computed. Incorrect caller 
information is usually due to logging via wrappers or interceptors in 
dynamic languages. In other words, computation of caller information is 
sensitive to the method invocation stack.

Are you using a dynamic language, AOP or a logger wrapper?

In any case, an actual stack trace would help understanding the problem. 
For example, if the following logger call results in incorrect caller info:

   logger.debug("Hello world");

print a stack trace just before (or after) that logger invocation, e.g.

   new Exception("testing").printStackTrace();
   logger.debug("Hello world");

I'd appreciate if you could post the stack trace here.

Best regards,


Can you post a stack trace


On 6/13/2013 2:43 PM, Mads Bondo Dydensborg wrote:
> Hi there.
>
> Using
>      <slf4j.version>1.7.5</slf4j.version>
>      <logback.version>1.0.13</logback.version>
>
> And, with the following in logback.xml:
>
>     <!-- Copy encoder from console -->
>      <encoder>
>         <!-- <pattern>%d{ISO8601} [%thread] rid:%X{trackingId} %-5level %logger{5} - %msg%n</pattern> -->
>         <!-- <pattern>%d{ISO8601} [%thread] rid:%X{trackingId} %-5level %logger{5}.%M:%L - %msg%n</pattern> -->
>         <pattern>%d{ISO8601} [%thread] rid:%X{trackingId} %-5level %class{5}.%M:%L - %msg%n</pattern>
>         <immediateFlush>true</immediateFlush>
>         <outputPatternAsHeader>true</outputPatternAsHeader>
>      </encoder>
>
> This outputs
> #logback.classic pattern: %d{ISO8601} [%thread] rid:%X{trackingId} %-5level %class{5}.%M:%L - %msg%n
> 2013-06-13 12:55:49,486 [main] rid: TRACE ?.?:? - entry
>
> Changing to the first commented pattern, gets me:
>
> #logback.classic pattern: %d{ISO8601} [%thread] rid:%X{trackingId} %-5level %logger{5} - %msg%n
> 2013-06-13 14:35:20,450 [main] rid: TRACE d.d.o.EnvironmentFactory - entry
>
> Second commented pattern:
> #logback.classic pattern: %d{ISO8601} [%thread] rid:%X{trackingId} %-5level %logger{5}.%M:%L - %msg%n
> 2013-06-13 14:36:37,689 [main] rid: TRACE d.d.o.EnvironmentFactory.?:? - entry
>
> Any idea what I am doing wrong here? The point was to get method name and line numbers, as per this:
> http://logback.qos.ch/manual/layouts.html#conversionWord
>
> Any clues?
>
> Thanks in advance.
>
> Mads
>


More information about the Logback-user mailing list