logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rayapudi Sandeep-mgb376" <rsand...@motorola.com>
Subject RE: Using more than one logger
Date Mon, 02 Apr 2007 16:28:28 GMT
Hi,
 
I removed asterics and tested, but it doesnt seem to work.
 
Config:
-----------
 
log4j.rootLogger=DEBUG
log4j.logger.sysmonLogger=DEBUG, myappender
 
log4j.additivity.sysmonLogger=false
log4j.appender.myappender=org.apache.log4j.RollingFileAppender
log4j.appender.myappender.File=../logs/sysmon.log
 
log4j.appender.myappender.MaxFileSize=100KB
log4j.appender.myappender.MaxBackupIndex=1
 
log4j.appender.myappender.layout=org.apache.log4j.PatternLayout

Program:
---------------
 
PropertyConfigurator::configure(LOG4CXX_FILE("temp.properties"));
                LoggerPtr rootLogger = Logger::getRootLogger();
                LoggerPtr logger = Logger::getLogger("sysmonLogger");
 
                //LOG4CXX_INFO(logger,"info into R");
                LOG4CXX_INFO(logger, "info message");
                LOG4CXX_WARN(logger, "warn message");
                LOG4CXX_ERROR(logger, "error message");

In above program, i tried both 
LoggerPtr logger = Logger::getLogger("sysmonLogger");  --> in this case,
it didnt print any error while debugging with gdb
and
LoggerPtr logger = Logger::getLogger("sysmon"); ---> this given
"log4cxx: No appender could be found for logger (sysmon)"
 
Please help me out
 
And also i am looking for a complete example (program and properties
file) for XMLSocketAppender, please send if any of you have.
 
Thnx a lot,
Sandeep

________________________________

From: Curt Arnold [mailto:carnold@apache.org] 
Sent: Monday, April 02, 2007 9:45 PM
To: Log4CXX User
Subject: Re: Using more than one logger




On Apr 1, 2007, at 10:44 AM, Rayapudi Sandeep-mgb376 wrote:


	Hi, 

	I am a newbie to Log4cxx and 
	I am trying to use more than one logger, and searched through
mailing list but solution given doesn't seem to work. 
	Please look at my code and config file and reply me where I am
doing   it wrong 
	  
	  Code: 
	  ----- 
	  
	  PropertyConfigurator::configure(LOG4CXX_FILE(pbConfigFile)); 
	  LoggerPtr rootLogger = Logger::getRootLogger(); logger =
Logger::getLogger("sysmonLogger"); 
	  LOG4CXX_INFO(logger, "********************* LOG OPEN
*********************\n"); 
	  
	  --  While I debug above code, this is the error message I got 
	  
	  log4cxx: No appender could be found for logger (sysmonLogger).

	  log4cxx: Please initialize the log4cxx system properly. 
	  
	  Config: 
	  ------- 
	  log4j.rootLogger=DEBUG 
	  log4j.*logger.*sysmonLogger=DEBUG, myappender 
	
	

Why do you have asterisks (*) in the previous line?  I have not seen
that documented and don't know of any code that supports wildcarding in
the properties file.  Unless I'm missing something, that line would not
be recognized by the PropertyConfigurator which would result in having
no appender for the sysmonLogger as indicated by the diagnostic message.
Remove the asterisks and report what happens.



Mime
View raw message