logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Confused Log4J2 User <groupposte...@gmail.com>
Subject Newbie questions around configuration
Date Wed, 13 Mar 2013 19:56:36 GMT
Hi, I have several questions for the group. I have read and studied the 2.x 
manual, but I could not find any examples or situations related to what I am 
trying to do.

1) My ultimate goal is to have certain levels, like TRACE and DEBUG, to go into 
the Console. At the same time, I want all of my Error lines to go to a file. 
When I run this servlet, all ERROR, DEBUG, and INFO lines go automatically to 
the Console while TRACE is ignored. Nothing ends up in the app.log file. INFO is 
not in this config file, but why would it appear on my Console?

<?xml version="1.0" encoding="UTF-8"?>
<configuration status="warn" name="MyApp" packages="">
  <appenders>
    <File name="MyFile" fileName="c:\tmp\app.log">
      <PatternLayout>
        <pattern>%d %p %C{1.} [%t] %m%n</pattern>
      </PatternLayout>
    </File>
    <Console name="Console" target="SYSTEM_OUT">
      <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - 
%msg%n"/>
    </Console>
  </appenders>
  <loggers>
    <root level="error">
      <appender-ref ref="MyFile"/>
    </root>
    <root level="debug">
     <appender-ref ref="Console"/>	
    </root>
  </loggers>
</configuration>

2) My project will ultimately spawn several servlets, and I'd like an easy way 
to say "Everything TRACE and below for servlet A" and "DEBUG only for servlet 
B". How should I go about configuring that?


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message