RE: Logging different Log-Level for the same Logger

2005-12-05 Thread Bender Heri
At the first glance I think it should work like you expect. I only ask me what 
the levels ISWARN and ISDEBUG should be. Did you define them yourself? Or is 
this a cpp issue? In java it would be WARN and DEBUG.

Which log file you get? If it is the second one (IS_SER_complete.log) then 
probably log4j couldn't create it. Probably because your monitoring process 
holds a lock on it? Could this be? Try to attach a console appender to the 
first logger in order to see if this logger gets initialized at all.

Heri

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Monday, December 05, 2005 4:46 PM
 To: log4j-user@logging.apache.org
 Subject: Logging different Log-Level for the same Logger
 
 
 
 Hi,
 
 I've got an application which is watched by an automatic 
 monitoring prozess. For this prozess I need a logfile with 
 log-messages from WARN to FATAL. If an error has happend, I 
 want another log-file with loglevel from DEBUG to FATAL with 
 different informations e.g. file and line number. My problem 
 is, that the secound configuration  overwrits the first one. 
 So I got only one log-file
 
 This is my configuration:
 
 log4cplus.logger.islog=ISWARN, ISLOG_FILE
 
 log4cplus.appender.ISLOG_FILE=log4cplus::RollingFileAppender
 log4cplus.appender.ISLOG_FILE.File=IS_SER.log
 log4cplus.appender.ISLOG_FILE.MaxFileSize=100MB
 log4cplus.appender.ISLOG_FILE.MaxBackupIndex=5
 log4cplus.appender.ISLOG_FILE.layout=log4cplus::PatternLayout
 log4cplus.appender.ISLOG_FILE.layout.ConversionPattern=
 20%D{%y-%m-%d %H:%M:%S};  %10p ;%-70c{2} ;%-700.700m;;%n
 
 log4cplus.logger=ISDEBUG, ISLOG_COMPLETE_FILE
 
 log4cplus.appender.ISLOG_COMPLETE_FILE=log4cplus::RollingFileAppender
 log4cplus.appender.ISLOG_COMPLETE_FILE.File=IS_SER_complete.log
 log4cplus.appender.ISLOG_COMPLETE_FILE.MaxFileSize=100MB
 log4cplus.appender.ISLOG_COMPLETE_FILE.MaxBackupIndex=5
 log4cplus.appender.ISLOG_COMPLETE_FILE.layout=log4cplus::PatternLayout
 log4cplus.appender.ISLOG_COMPLETE_FILE.layout.ConversionPatter
 n=  20%D{%y-%m-%d %H:%M:%S};  %-10p; %c{2}; %m;%F;%L;%n
 
 I'm using log4cplus, but you would help me, if you can tell 
 me, if this configuration would work with log4j. 
 Unfortunaltly the Trafik in the log4cplus forum is very poor.
 
 Many Thanks
 
 Mark 
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Logging different Log-Level for the same Logger

2005-12-05 Thread Bender Heri
See below.

 Yes you are right. We had to define our own log-levels 
 because we had to write the severity-text and the 
 severity-level. But I did one mistake in the example: Both 
 Logger use log4cplus.logger.islog. So the following two 
 lines are correct. Sorry.
 log4cplus.logger.islog=ISWARN, ISLOG_FILE
 log4cplus.logger.islog=ISDEBUG, ISLOG_COMPLETE_FILE

This is the culprit. You cant use the same name for two (intended) different 
loggers.
You should use only one Logger to which you assign two appenders:

log4cplus.logger.islog=ISDEBUG, ISLOG_FILE, ISLOG_COMPLETE_FILE

The problem now arises how you can filter the DEBUG and INFO messages for the 
ISLOG_FILE appender. There should be the property threshold on the appender:
log4cplus.appender.ISLOG_FILE.Threshold=WARN

This should do the trick.

Heri

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]