You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Jones, Marty B." <ma...@dailyaccess.com> on 2003/11/20 12:51:50 UTC

Log4J Question

I was wondering if Log4J will allow me to do the following:

configure a RollingFileAppender that logs standard output.
configure a RollingFileAppender that logs info and warning output.
configure a RollingFileAppender that logs error level output.

have a single logger that will use one of the above appenders based upon the
logging level of the log method called within a given class.


Thank you for your time,

Marty


________________________
Marty B. Jones
Senior Software Engineer
DailyAccess.Com


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


Re: Log4J Question

Posted by Paul Smith <pa...@lawlex.com.au>.
On Thu, 2003-11-20 at 22:51, Jones, Marty B. wrote:
> I was wondering if Log4J will allow me to do the following:
> 
> configure a RollingFileAppender that logs standard output.
> configure a RollingFileAppender that logs info and warning output.
> configure a RollingFileAppender that logs error level output.
> 
> have a single logger that will use one of the above appenders based upon the
> logging level of the log method called within a given class.

Yes, you can do this.  

* You will need to use the XML configuration file, as this supports
appender filters.
* Define each of the appenders in the xml file, and create a filter
section for each resepective appender based on the level.

* attach all the appenders to your single logger.

The wiki has a good example on this:
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/LogByLevel

cheers,

Paul


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