[logback-user] Logging from different threads

Ceki Gulcu ceki at qos.ch
Fri Feb 27 09:30:46 CET 2009


Hello Lukas,

Your configuration file looks good. I see no reason why logging output
should be generated correctly from some worker threads and not
others. Are you sure that the silent thread is active?

Here are some remarks about your configuration file *unrelated* to the
problem your you are describing. As of logback version 0.9.15, if no
class name is provided, layout property will default to
PatternLayout. This, the next two configuration excerpts are
equivalent:

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
   <!-- no class attribute specified -->
   <layout>
     <Pattern>%d{HH:mm:ss} [%thread] %-5level %logger{20} - %msg%n</Pattern>
   </layout>
</appender>


<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
   <layout class="ch.qos.logback.classic.PatternLayout">
     <Pattern>%d{HH:mm:ss} [%thread] %-5level %logger{20} - %msg%n</Pattern>
   </layout>
</appender>

There is another minor observation I would like to make.

Setting the level of a threshold filter to TRACE makes it (the filter)
a pass through filter. The threshold filter in FileAppender is set to
the level TRACE.  On the other hand, setting such a filter does not
hurt either, except perhaps cluttering the configuration file.

Lukas Zapletal wrote:
> Hello,
> 
> I have application with 4 threads called M, 1, 2 and 3. Its using Logback
> over slf4j in normal way:

[snip]

  > The problem: I cannot see error messages logged by one of "worker" threads.
> I have no clue why. Its not from freemarker.cache package - its different
> package (com.pike.blabla).
> 
> --
> Lukas Zapletal


-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch


More information about the Logback-user mailing list