logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Re: Differentiating calls to the same function
Date Thu, 21 Apr 2005 16:23:06 GMT
There are several technical reasons why it would be difficult and/or 
expensive for log4j and log4cxx to provide a method invocation count 
(the fairly substantial cost of obtaining location info in log4j is 
one).  It is a lot easier for the caller to maintain that count which 
could either be formatted into the message or placed in a NDC or MDC.  
Something like:

void stuff() {
    static int callCount = 0;
    LOG4CXX_DEBUG(std::string("Call to stuff() #") + itoa(callCount));

On Apr 21, 2005, at 10:11 AM, Thierry Lam wrote:

> Consider the following example:
> Calling function stuff()
> Calling function doThing()
> Calling function stuff()
> In my log file, is there some feature which allows me to do the
> following:
> (date-time) 1st call to stuff()
> (date-time) 1st call to doThing()
> (date-time) 2nd call to stuff()
> Thanks
> Thierry

View raw message