logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carol Enderlin" <carol.ender...@gmail.com>
Subject Re: "additivity" attribute does not work for user-defined logger but works for root logger.
Date Fri, 04 Jul 2008 02:00:56 GMT
My answers below...

> Why the root logger defined:
> <root>
>         <level value="debug"/>
>         <appender-ref ref="taskRedirection"/>
>         <appender-ref ref="addQuestionSequenceOrder"/>
> </root>
> knows that all the logs from ALL the classes should go the the file
> specified by appenders:taskRedirection, addQuestionSequenceOrder

That's the way it's supposed to work, root logger gets everything
unless you configure it not to.

> and a logger:
> <logger name="curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter"
> additivity="true">
>        <level value="debug"/>
>        <appender-ref ref="addQuestionSequenceOrder"/>
> </logger>
> knows that ONLY logs from that class
> curam.tools.upgradehelper.ieg.QuestionSequenceOrderConverter has to be
> "served"?

That's the way that is supposed to work, too. You can get less
specific and get all classes in a package hierarchy to log to a
logger. Example:

<logger name="curam.tools.upgradehelper" ...

> If not, why this parameter additivity="true" is present at all? It does
> nothing.

additivity is true by default, so you are correct that setting
additivity="true" doesn't change the behavior.

There is an excellent description of how additivity works in log4j
short manual http://logging.apache.org/log4j/1.2/manual.html

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

View raw message