Re: [Log4cplus-devel] Performance hit when loggin?
Logging Framework for C++
Brought to you by:
wilx
From: Václav Z. <vha...@gm...> - 2014-04-02 18:25:38
|
On 04/02/2014 07:45 PM, Ciummo, Lawrence wrote: > I’ve got an application that does a lot of disk IO set up to use about > 1000 different log files. Normally, the log level is set to DEBUG level > so that there is almost no logging at runtime (maybe 2-3 logs over a 4 > hour period). I see about a 5% hit to overall performance (measured by > IOPS to the disks) when logging code in my build (ie it’s 5% faster > without any log4cplus code at all ). > > > > Is there any explanation for this? > > > > Does a call like… > > LOG4CPLUS_TRACE(_drive_logger, "Entering... debug="<< debug); > > > > Cause any processing with log level set to DEBUG? Is the string > constructed if the logging level set to DEBUG. The macro is defined in `log4cplus/loggingmacros.h`. You can see there for yourself; look for `LOG4CPLUS_MACRO_BODY`. The string should be built only if you are actually going to log, there is log level check before the string formatting is done. The log level check obviously has some small overhead as well. I cannot tell if 5 % of your IOPS is within limits of expectation or not. Try running your application with and without log4cplus logging under a profiler. -- VZ |