logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anita Banerji" <Anita.Bane...@postgrad.manchester.ac.uk>
Subject level problem
Date Fri, 02 Nov 2007 14:49:11 GMT
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?





From: Anita Banerji [mailto:Anita.Banerji@postgrad.manchester.ac.uk] 
Sent: 18 October 2007 09:11
To: log4cxx-user@logging.apache.org
Subject: level problem




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,






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,

            outstream= log;

            *outstream << Level::INFO << "creating a new image volume "





void ImageVolume::generateImage(shared_ptr<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;


View raw message