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 Ofer Kalisky <ka...@hotmail.com> on 2009/10/21 20:14:49 UTC
Logging without logging to the root logger
Hi,
I have the following config:
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="reportFileAppender"
class="org.apache.log4j.RollingFileAppender">
<!-- Keep one backup file -->
<layout class="org.apache.log4j.PatternLayout">
</layout>
</appender>
<appender name="stdoutAppender" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
</layout>
</appender>
<logger name="db_report">
<level value="info" />
<appender-ref ref="reportFileAppender"/>
</logger>
<logger name="com.mycompany">
<level value="info" />
</logger>
<root>
<priority value="warn"/>
<appender-ref ref="stdoutAppender"/>
</root>
</log4j:configuration>
In the source I do:
private static Logger reportLogger = Logger.getLogger("db_report");
and in other classes I do:
private static Logger anyClassLogger =
Logger.getLogger(com.mycompany.MyClass.class);
I would like things logged to the db_report not to be logged in the
stdoutAppender, but I can't get them out of there, since the root logger has
it and it seems it catches all...
how can I log things to the report.log file without it being outputted to
the stdout as well?
thanks
--
View this message in context: http://www.nabble.com/Logging-without-logging-to-the-root-logger-tp25997550p25997550.html
Sent from the Log4j - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: Logging without logging to the root logger
Posted by Matt Brown <Ma...@citrixOnline.com>.
Why don't you just move the appender-ref for stdoutAppender from the root level to the "my.company" logger?
-----Original Message-----
From: Ofer Kalisky [mailto:kalisky@hotmail.com]
Sent: Wednesday, October 21, 2009 2:15 PM
To: log4j-user@logging.apache.org
Subject: Logging without logging to the root logger
Hi,
I have the following config:
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="reportFileAppender"
class="org.apache.log4j.RollingFileAppender">
<!-- Keep one backup file -->
<layout class="org.apache.log4j.PatternLayout">
</layout>
</appender>
<appender name="stdoutAppender" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
</layout>
</appender>
<logger name="db_report">
<level value="info" />
<appender-ref ref="reportFileAppender"/>
</logger>
<logger name="com.mycompany">
<level value="info" />
</logger>
<root>
<priority value="warn"/>
<appender-ref ref="stdoutAppender"/>
</root>
</log4j:configuration>
In the source I do:
private static Logger reportLogger = Logger.getLogger("db_report");
and in other classes I do:
private static Logger anyClassLogger =
Logger.getLogger(com.mycompany.MyClass.class);
I would like things logged to the db_report not to be logged in the stdoutAppender, but I can't get them out of there, since the root logger has it and it seems it catches all...
how can I log things to the report.log file without it being outputted to the stdout as well?
thanks
--
View this message in context: http://www.nabble.com/Logging-without-logging-to-the-root-logger-tp25997550p25997550.html
Sent from the Log4j - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
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
AW: Logging without logging to the root logger
Posted by Bender Heri <hb...@ergonomics.ch>.
<logger name="db_report" additivity="false">
<level value="info" />
<appender-ref ref="reportFileAppender"/>
</logger>
-----Ursprüngliche Nachricht-----
Von: Ofer Kalisky [mailto:kalisky@hotmail.com]
Gesendet: Mittwoch, 21. Oktober 2009 20:15
An: log4j-user@logging.apache.org
Betreff: Logging without logging to the root logger
Hi,
I have the following config:
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="reportFileAppender"
class="org.apache.log4j.RollingFileAppender">
<!-- Keep one backup file -->
<layout class="org.apache.log4j.PatternLayout">
</layout>
</appender>
<appender name="stdoutAppender" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
</layout>
</appender>
<logger name="db_report">
<level value="info" />
<appender-ref ref="reportFileAppender"/>
</logger>
<logger name="com.mycompany">
<level value="info" />
</logger>
<root>
<priority value="warn"/>
<appender-ref ref="stdoutAppender"/>
</root>
</log4j:configuration>
In the source I do:
private static Logger reportLogger = Logger.getLogger("db_report");
and in other classes I do:
private static Logger anyClassLogger =
Logger.getLogger(com.mycompany.MyClass.class);
I would like things logged to the db_report not to be logged in the stdoutAppender, but I can't get them out of there, since the root logger has it and it seems it catches all...
how can I log things to the report.log file without it being outputted to the stdout as well?
thanks
--
View this message in context: http://www.nabble.com/Logging-without-logging-to-the-root-logger-tp25997550p25997550.html
Sent from the Log4j - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
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