logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephane Nicoll" <snic...@kiala.com>
Subject RE: logs duplicated: INFO & DEBUG
Date Wed, 04 Feb 2004 16:01:57 GMT
Thanks. I managed to do it another way, see below.

I limit third party libs debugging output. Then I put it to DEBUG by default
and I use the Treshold attribute of one of the appender to limit the output
to debug. That does exactly what I want.

What I am wondering now is: "What if org.jboss.ejb.EJBDeployer logger a
warning/error". It will be duplicated I assume :/

Cheers,

Stephane

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<!-- =====================================================================
-->
<!--  Log4j Configuration
-->
<!-- =====================================================================
-->
<!-- $Id: log4j.xml,v 1.1 2004/02/04 13:30:23 snicoll Exp $ -->
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="false">

    <!-- ============================== -->
    <!-- the main log file              -->
    <!-- ============================== -->
    <appender name="FILE"
class="org.jboss.logging.appender.DailyRollingFileAppender">
        <param name="File" value="${jboss.server.home.dir}/log/server.log"/>
        <param name="Threshold" value="INFO"/>
        <param name="Append" value="true"/>
        <param name="DatePattern" value="'.'yyyy-MM-dd-a"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{3}]
%m%n"/>
        </layout>
    </appender>

    <!-- =================================== -->
    <!-- the log file containing debug info  -->
    <!-- =================================== -->
    <appender name="DEBUG"
class="org.jboss.logging.appender.DailyRollingFileAppender">
        <param name="File"
value="${jboss.server.home.dir}/log/server_debug.log"/>
        <param name="Append" value="true"/>
        <param name="DatePattern" value="'.'yyyy-MM-dd-a"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{3}]
%m%n"/>
        </layout>
    </appender>


    <!-- Third party logging (JBoss & Apache libraries) -->
    <category name="org.jboss">
        <priority value="WARN"/>
    </category>

    <category name="org.jboss.ejb.EJBDeployer" additivity="false">
        <priority value="INFO"/>
        <appender-ref ref="FILE"/>
        <appender-ref ref="DEBUG"/>
    </category>

    <category name="org.jboss.deployment.EARDeployer" additivity="false">
        <priority value="INFO"/>
        <appender-ref ref="FILE"/>
        <appender-ref ref="DEBUG"/>
    </category>

    <category name="org.jboss.system.server.Server" additivity="false">
        <priority value="INFO"/>
        <appender-ref ref="FILE"/>
        <appender-ref ref="DEBUG"/>
    </category>

    <category name="org.apache">
        <priority value="WARN"/>
    </category>


    <!-- ======================= -->
    <!-- Setup the Root category -->
    <!-- ======================= -->
    <root>
        <priority value="DEBUG"/>
        <appender-ref ref="FILE"/>
        <appender-ref ref="DEBUG"/>
    </root>

</log4j:configuration>

-----Original Message-----
From: Ferenc Toth [mailto:ftoth@eu.infobal.com]
Sent: Wednesday, February 04, 2004 4:52 PM
To: Log4J Users List
Subject: RE: logs duplicated: INFO & DEBUG


> From: Stephane Nicoll [mailto:snicoll@kiala.com] 
> 
> I am interested in 
> 
> 1/ Is it possible to log stuff with level INFO in one file 
> and exactly the
> same plus DEBUG messages in another file?

As far as I know you have to use a filter to get this, and this means, you'll
need an xml config file. But that's pretty easy. Quick sketch to start with:

	<appender name="debug" class="whatever">
		<filter class="org.apache.log4j.varia.LevelRangeFilter">
			<param name="LevelMax" value="DEBUG" />
		</filter>
		some layout
	</appender>

	<appender name="everythingelse" class="whatever2">
	</appender>

	<root>
		<priority value="debug"/>
		<appender-ref ref="debug"/>
		<appender-ref ref="everythingelse"/>
	</root>

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