I am also finding a significant performance penalty when including DEBUG level statements even though this level is not enabled, and therefore have to comment out log4cxx code out of frequently run areas.
Any ideas on how I can fix this? Thanks. ________________________________ From: Anita Banerji [mailto:[EMAIL PROTECTED] Sent: 18 October 2007 09:11 To: [email protected] Subject: level problem Hi, I wish to print out variable values within my code at the various different logging levels. However, debug level statements are printed when there are also info level statements within the same function. I'd appreciate any advice on how to prevent this happening. With the level set to INFO in the config file: log4j.logger.ImageVolume=INFO I would not expect to see the debug level output: "generateImage: xMax: ok". Thank you, Anita Output: INFO ImageVolume - creating a new image volume INFO ImageVolume - generateImage: no noise added INFO ImageVolume - generateImage: mapping to image INFO ImageVolume - generateImage: xMax: okgenerateImage: complete In ImageVolume.h class ImageVolume { static log4cxx::LoggerPtr logger; shared_ptr<logstream> outstream; ... }; In ImageVolume.cc LoggerPtr ImageVolume::logger(Logger::getLogger("ImageVolume")); ImageVolume::ImageVolume(shared_ptr<TissueToVoxelMap> tissueToVoxelMap) { shared_ptr<logstream> log(new logstream(logger, Level::OFF)); outstream= log; *outstream << Level::INFO << "creating a new image volume " << LOG4CXX_ENDMSG; ... } void ImageVolume::generateImage(shared_ptr<SignalProduction> signalProduction, shared_ptr<TissueToVoxelMap> tissueToVoxelMap, shared_ptr<Noise> noise) { *(outstream.get()) << Level::INFO << "generateImage: no noise added " << LOG4CXX_ENDMSG; shared_ptr< map<TISSUETYPE, SIGNAL_INTENSITY> > tissueToSignalMap= signalProduction->generateSignalForAllTissues(); unsigned xMax= image->getDimX(); unsigned yMax= image->getDimY(); unsigned zMax= image->getDimZ(); *(outstream.get()) << Level::INFO << "generateImage: mapping to image" << LOG4CXX_ENDMSG; *outstream << Level::DEBUG << "generateImage: xMax: " << xMax << " ok" << LOG4CXX_ENDMSG; ... *(outstream.get()) << Level::INFO << "generateImage: complete" << LOG4CXX_ENDMSG; }
