logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From garfield168 <garfield...@gmx.de>
Subject Logging with specialized logger for webapplication
Date Mon, 25 Jun 2012 12:05:38 GMT


We use WebSphere as application server which has the standard logging files
SystemOut.log and SystemErr.log.
I want to create a log4j configuration with a special logger "SpecialLogger"
which logs all debug/info/error messages to a special log file. Additionally
error messages should be logged to SystemErr.log but the debug/info messages
from this logger should not be logged to SystemOut.log (but other info
messages not from this logger should be logged).
Maybe there is a solution with additivity="false" and LevelRangeFilter but I
cannot get it work like described. 
Here is my last try:

<?xml version="1.0"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
    <appender name="stdout" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
  <appender name="SpecialLoggerAppender"
        <layout class="org.apache.log4j.SimpleLayout"/>
         <filter class="org.apache.log4j.varia.LevelRangeFilter">
	<logger name="SpecialLogger" additivity="false">
		<level value="error" />
		<appender-ref ref="SpecialLoggerAppender" />
        <level value="error"/>
        <appender-ref ref="stdout" />

Can someone help please?
Thanks in advance
View this message in context: http://old.nabble.com/Logging-with-specialized-logger-for-webapplication-tp34066057p34066057.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

View raw message