Re: Logging with specialized logger for webapplication

2012-06-26 Thread garfield168

Hey,

I solved my problem. Mainly the target System.err in an extra
ConsoleAppender was missing.
I will attach the correct working log4j conf file.

http://old.nabble.com/file/p34071193/log4j.xml log4j.xml 

-- 
View this message in context: 
http://old.nabble.com/Logging-with-specialized-logger-for-webapplication-tp34066057p34071193.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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



AW: Logging with specialized logger for webapplication

2012-06-26 Thread Stadelmann Josef
There is a root logger; and there are loggers lower in the hierarchies.

Each logger needs appenders. (devices) where ever a message originates, 
as long as a logger is said that its additivity=false 
as long as the events logged by this logger are not propagated further to 
the root logger. That is what additivity=false does.

in your case you need to log all events with log.debug(debug) at your 
special logger. With additivity=true you allow that this logging events 
will make it to upper loggers in the hierarchies and after all reach the 
root logger

At the root logger you have an appender too, don't you?
This appender is now informed, to only log info, warning, error, fatal events 
only.

So make first sure that your special logger logs all events and that all events 
reach the root logger then filter at the root not with the logger but the 
appender 
of the root logger.

Josef



-Ursprüngliche Nachricht-
Von: garfield168 [mailto:garfield...@gmx.de] 
Gesendet: Montag, 25. Juni 2012 14:06
An: log4j-user@logging.apache.org
Betreff: Logging with specialized logger for webapplication


Hello,

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

/layout
/appender
  appender name=SpecialLoggerAppender
class=org.apache.log4j.RollingFileAppender



layout class=org.apache.log4j.SimpleLayout/
 filter class=org.apache.log4j.varia.LevelRangeFilter


/filter
/appender 
logger name=SpecialLogger additivity=false
level value=error /
appender-ref ref=SpecialLoggerAppender /
/logger

root
level value=error/
appender-ref ref=stdout /
/root
/log4j:configuration


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-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org


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



Logging with specialized logger for webapplication

2012-06-25 Thread garfield168

Hello,

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

/layout
/appender
  appender name=SpecialLoggerAppender
class=org.apache.log4j.RollingFileAppender



layout class=org.apache.log4j.SimpleLayout/
 filter class=org.apache.log4j.varia.LevelRangeFilter


/filter
/appender 
logger name=SpecialLogger additivity=false
level value=error /
appender-ref ref=SpecialLoggerAppender /
/logger

root
level value=error/
appender-ref ref=stdout /
/root
/log4j:configuration


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-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Logging with specialized logger for webapplication

2012-06-25 Thread Jacob Kjome


I think some of your config is missing.  It must have gotten messed up by your 
email client or something?  Maybe you can try to attach (can't remember if the 
list allows attachments) or post a link to the config.


Jake


On Mon, 25 Jun 2012 05:05:38 -0700 (PDT)
 garfield168 garfield...@gmx.de wrote:


Hello,

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

/layout
/appender
  appender name=SpecialLoggerAppender
class=org.apache.log4j.RollingFileAppender



layout class=org.apache.log4j.SimpleLayout/
 filter class=org.apache.log4j.varia.LevelRangeFilter


/filter
/appender 
	logger name=SpecialLogger additivity=false

level value=error /
appender-ref ref=SpecialLoggerAppender /
/logger

    root
level value=error/
appender-ref ref=stdout /
/root
/log4j:configuration


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-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org





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