logo       

RE: Using more than one logger: msg#00005

Subject: RE: Using more than one logger
Hi Curl,
 
Thanks for quick response
 
- specified folder and file in properties do exist
- given write permissions to ALL in ../logs/sysmon.log file
- When i changed it to ConsoleAppender, it printed on console.
- It did NOT worked when i changed to FileAppender
 
I am using log4cxx-0.10.0 version on RHEL 3
 
Thnx,
Sandeep


From: Curt Arnold [mailto:carnold@xxxxxxxxxx]
Sent: Monday, April 02, 2007 10:56 PM
To: Log4CXX User
Subject: Re: Using more than one logger


On Apr 2, 2007, at 11:28 AM, Rayapudi Sandeep-mgb376 wrote:

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


That there is a different behavior for Logger::getLogger("sysmon") than for Logger::getLogger("sysmonLogger") suggests to me that your configuration file is being read and an appender is attached to "sysmonLogger", but it is not working as you expect.  Otherwise, I'd ask you to confirm that your configuration file is really named "temp.properties".

Your configuration file does specify use of a PatternLayout, but doesn't specify a conversion pattern, but that should default to the equivalent of:

log4j.appender.myappender.layout.ConversionPattern=%m%n

To troubleshoot, I'd check the following:

Does the ../logs directory exist and does the current user have write privileges?  If the directory does not exist, log4cxx will not currently create it (may change in the future).

If ../logs/sysmon.log exists, does the current user have write privileges?

What happens if you switch from org.apache.log4j.RollingFileAppender to org.apache.log4j.ConsoleAppender?  If you get console output, then I'd then try just a plain FileAppender before switching back to a RollingFileAppender.

You did not specify what version of log4cxx you are using or operating system that you are using.  Use of log4cxx-0.9.7 is no longer supported or recommended.

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe