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:[EMAIL PROTECTED] 
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.

Reply via email to