[logback-user] logger wildcard name?

Joseph Schmoley jacomoman78 at gmail.com
Fri Apr 8 02:13:16 CEST 2011


I've got a logback.xml config (pasted below).  All I'm trying to do is have
a different logging level, as well as slightly different encoder pattern,
for what shows up in the console vs. what gets written to a file.

I understand that you have to create 2 different appenders, FILE and
CONSOLE, then set root logger for console only with leve="info", and create
a separate logger referencing FILE appender with a different logging level.

I've done this, but I can't figure out how to set the logger name to a
wildcard so I can get "ALL" output directed to the file.  You see, just like
the root logger that has no "name", I want that for the <logger> as well,
but it requires a name and I've tried putting "*" in it and it doesn't
work.  I don't want to log just "com.acme.*" output, I want to log
everything the root logger is logging.

Help please!

Thank you.


<configuration>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>../logs/esign-app.log</file>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %level [%thread] [%class{0}:%line]
%msg%n</pattern>
</encoder>
</appender>
 <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} %level [%thread] [%class{0}:%line]
%msg%n</pattern>
</encoder>
</appender>
 <logger name="com.acme" level="debug" additivity="false">
<appender-ref ref="FILE" />
</logger>

<root level="info">
<appender-ref ref="CONSOLE" />
</root>
</configuration>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/logback-user/attachments/20110407/21f06bbb/attachment-0001.html>


More information about the Logback-user mailing list