logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <thomas.haw...@oocl.com>
Subject RE: Newbie question
Date Mon, 27 Feb 2006 17:43:17 GMT
Francois,

 

If I remember correctly, logging is hierarchical, meaning a logger B
inheriting from logger A will invoke the appenders for both B and A.
All loggers "inherit" from the root logger.  Although I forget the
property, I think all you need to do is to tell your logger not to also
write to its ancestors.

 

Cheers!

 

Tom Hawker

Home      408-274-4128

Office      408-576-6591

Mobile    408-835-3643

  _____  

From: Francois MAROT [mailto:francois.marot@laposte.net] 
Sent: Monday, February 27, 2006 07:37 AM
To: log4cxx-user@logging.apache.org
Subject: Newbie question

 

Hi all,

i'm about to implement a logging system and have been experimenting with
log4cxx recently. But i have some problems...
The fact is I don't try to do anything very hard, only configuring
properly my output to a desired file.

here's my c++ code:

PropertyConfigurator::configure("ACSA-log4cxx-DBG.properties");
LoggerPtr fraLogger = Logger::getLogger("log4j.fraLogger");
LOG4CXX_INFO(fraLogger, "1 - info");
LOG4CXX_WARN(fraLogger, "2 - warn");
LOG4CXX_ERROR(fraLogger, "3 - error");
LOG4CXX_FATAL(fraLogger, "4 - fatal");


and here is my file ACSA-log4cxx-DBG.properties :

log4j.rootLogger = DEBUG, ACSALogger
log4j.appender.ACSALogger = org.apache.log4j.RollingFileAppender
log4j.appender.ACSALogger.layout = org.apache.log4j.PatternLayout
log4j.appender.ACSALogger.layout.ConversionPattern=%-4r [%t] %-5p %c %x
- %m%n
log4j.appender.ACSALogger.File = ACSA-log4cxx.log

log4j.fraLogger = ERROR, ACSALogger2
log4j.appender.ACSALogger2 = org.apache.log4j.RollingFileAppender
log4j.appender.ACSALogger2.layout = org.apache.log4j.SimpleLayout
log4j.appender.ACSALogger2.File = TMP.log

I thought, as i stated in code i wanted to use logger "log4j.fraLogger",
that my logging info would be written 
in the file named "TMP.log". But it is written in file
"ACSA-log4cxx.log". I thought only rootlogger would
write to this file... Am I missing something ?

Thanks


Francois



IMPORTANT NOTICE
Email from OOCL is confidential and may be legally privileged.  If it is not intended for
you, please delete it immediately unread.  The internet cannot guarantee that this communication
is free of viruses, interception or interference and anyone who communicates with us by email
is taken to accept the risks in so doing.  Without limitation, OOCL and its affiliates accept
no liability whatsoever and howsoever arising in connection with the use of this email.  Under
no circumstances shall this email constitute a binding agreement to carry or for provision
of carriage services by OOCL, which is subject to the availability of carrier's equipment
and vessels and the terms and conditions of OOCL's standard bill of lading which is also available
at http://www.oocl.com.

Mime
View raw message