[prev in list] [next in list] [prev in thread] [next in thread] 

List:       log4j-user
Subject:    RE: [SCL-3] deploying several log files
From:       Bender Heri <hbender () ergonomics ! ch>
Date:       2010-04-14 11:07:46
Message-ID: 9136AE131D290D4B8E66FF863C1F69238846ADF81D () mars ! bahamas ! ergo
[Download RAW message or body]

The loggers, if their names contain dots (like yours es.indra) form a hierarchy based \
on these dots. If in code you you fetch a named logger (i.e. "es.indra.something") \
there will be a logger instance in the repository but no appenders attached (because \
it is not configured in the xml file). Log statements issued on this logger climb up \
the hierarchy. The logger "es.indra" is found, and its appender served. If there is \
no additivity attribute (or ="true" which is the default) the climbing goes on until \
it reaches the root logger. All Appenders of all Loggers found on this way are \
served. If a Logger is found which has the additivity flag="false" the climbing up \
the hierarchy stops. So, log statements issued on the logger "es.indra.segurcaixa" \
end up in the configured logger "es.indra" and not reach the root logger, but \
statements issued to a logger named "com.xy" would reach the root logger. Heri

es.indra.segurcaixa.expedientevirtual.event.cataloger
-----Original Message-----
From: Marco Silva [mailto:mlsilvaz@gmail.com] 
Sent: Wednesday, April 14, 2010 12:56 PM
To: Log4J Users List
Subject: Re: [SCL-3] deploying several log files

Hi Heri:
Reviewing this XML , I saw the root logger has the same appender-ref
ref="CATALOGER_FILE_APPENDER" .
So this should have the same impact?
Below I copied the all XML which I reviewing.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

    <appender name="CATALOGER_FILE_APPENDER"
class="org.apache.log4j.RollingFileAppender">
        <param name="File"
value="C:/apps/segurcaixa/expvirtual/workspace/scev-fs/logs/scev-cataloger.log"
/>
        <param name="Append" value="true" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d %-5p - %m%n"/>
        </layout>
    </appender>

    <appender name="CONSOLE_APPENDER"
class="org.apache.log4j.ConsoleAppender">
        <param name="Target" value="System.Out"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d %-5p - %m%n"/>
        </layout>
    </appender>

    <category name="es.indra" additivity="false">
        <level value="DEBUG"/>
        <appender-ref ref="CATALOGER_FILE_APPENDER"/>
    </category>


    <category name="es.indra.segurcaixa.expedientevirtual.event.cataloger"
additivity="false">
        <priority value="WARN"/>
        <appender-ref ref="CATALOGER_FILE_APPENDER"/>
    </category>

    <root>
        <level value="WARN" />
        <appender-ref ref="CATALOGER_FILE_APPENDER"/>
    </root>

</log4j:configuration>


Saludos
Marco Silva
EAI Consultant


On Wed, Apr 14, 2010 at 11:48 AM, Bender Heri <hbender@ergonomics.ch> wrote:

> Add the attribute additivity="false" to your specialized loggers in order
> to not have the log output in the root logger:
> 
> <category name="package1" additivity="false">
> <priority value="WARN"/>
> <appender-ref ref="CATALOGER_FILE_APPENDER"/>
> </category>
> 
> Heri
> 
> -----Original Message-----
> From: Marco Silva [mailto:mlsilvaz@gmail.com]
> Sent: Wednesday, April 14, 2010 11:15 AM
> To: log4j-user@logging.apache.org
> Subject: [SCL-3] deploying several log files
> 
> Hi All,
> IŽll try to describe my problem, describing my context:
> 
> I'm maintaining an app which uses Log4j to generate several file logs (one
> log per module event of data loaded on the DB), each file log is filled by
> events which start in filenet by several apps deployed in Websphere (WAR) ,
> each module has his own XML .
> So my problem is only one file log is filled for all modules, initially I
> saw each XML configuration file doesnŽt have the package identified, so
> IŽve
> changed this putting package1, package2, package3.
> But now I see and expression <ROOT> as is described below, I donŽt know if
> this should be keep it in each XML configuration file?
> 
> 
> <!-- category name="ALL"-->
> <category name="package1">
> <priority value="WARN"/>
> <appender-ref ref="CATALOGER_FILE_APPENDER"/>
> </category>
> 
> <root>
> <levvalue="WARN" />
> <appender-ref ref="CATALOGER_FILE_APPENDER"/>
> </root>
> 
> --
> 
> Regards
> Marco Silva
> EAI Consultant
> 
> ---------------------------------------------------------------------
> 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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic