
To do this you need the root logger set to level debug and configured with both appenders. You then have to add a ThresholdFilter to the Console appender set to level "info". Ralph On Apr 7, 2011, at 5:13 PM, Joseph Schmoley wrote:
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>
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user