logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Drinkwater, GJ \(Glen\)" <g.j.drinkwa...@dl.ac.uk>
Subject RE: Log4j xml configuration
Date Thu, 15 Feb 2007 15:59:43 GMT
Hi

Thanks for the help.  Also, is it possible to level filter a package
like you can do with a appender. 

What I have done is to set the root threshold to FATAL and then for
certain packages lower the level to DEBUG or INFO.  But for this one
package, I want to see the info and traces logged etc, but not to log
the ERROR or FATAL.

Is this possible?

glen 

-----Original Message-----
From: Kamal Ahmed [mailto:KAhmed@webMethods.com] 
Sent: 15 February 2007 15:40
To: Log4J Users List
Subject: RE: Log4j xml configuration

Glen,

Here is a sample which will help you understand how you can use xml
config file, basically you use the format:
        <level value="info" />

In the logger section:

Here are the file contents:

<?xml version="1.0" encoding="UTF-8" ?>
<webm_journal_logging>
    <appender name="StdErr" class="org.apache.log4j.ConsoleAppender">
        <param name="target" value="System.Err" />
        <layout
class="com.webmethods.sc.logging.log4j.DefaultG8dEventLayout" />
    </appender>
<!--  This appender will send log messages with a level of 'warn'
          and above to './log/server.log'; with daily rollover to,
          e.g. './log/server.log.2006-07-17'.
    -->
    <appender name="DailyFile"
class="com.webmethods.sc.logging.log4j.WmDailyFileAppender">
        <param name="file" value="log/server.log" />
        <param name="datePattern" value=".yyyy-MM-dd" />
        <param name="threshold" value="debug" />
        <layout
class="com.webmethods.sc.logging.log4j.DefaultG8dEventLayout" />
    </appender>
    <logger name="webm.sc.sample.sub1" additivity="true">
        <level value="info" />
        <appender-ref ref="StdErr" />
        <appender-ref ref="DailyFile" />
    </logger>
    <root>
        <level value="debug" />
        <appender-ref ref="DailyFile" />
        <appender-ref ref="StdErr" />
    </root>
    <threshold>
        <level value="debug" />
    </threshold>
</webm_journal_logging>


-Kamal.


-----Original Message-----
From: Drinkwater, GJ (Glen) [mailto:g.j.drinkwater@dl.ac.uk]
Sent: Wednesday, February 14, 2007 8:20 AM
To: log4j-user@logging.apache.org
Subject: Log4j xml configuration

Hi

I am currently moving all our log4j.properties files to XML files and
was wondering how I replicate this with the xml configuration.

In the properties file, I can put in 

log4j.logger.my.package=DEBUG

Which means only logs from 'my.package' with level DEBUG or above gets
logged and anything outside these package does not.

How do I do this with an XML configuration.

Thanks Glen

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



---------------------------------------------------------------------
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