Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: log4perl and efficiency

by Solo (Deacon)
on Sep 12, 2011 at 17:17 UTC ( #925517=note: print w/replies, xml ) Need Help??

in reply to log4perl and efficiency

The Log::Log4perl POD has a section with ways to improve log4perl performance. It looks to me like you should wrap that log string into a function so it doesn't need to interpolate when logging is off.

Replies are listed 'Best First'.
Re^2: log4perl and efficiency
by erwan (Sexton) on Sep 12, 2011 at 17:30 UTC

    Unless I misunderstood, that's what I did. well, not using a function but the "if (condition) { log }" does the same thing, doesn't it?

      That's one approach. I was suggesting:
      $self->{logger}->trace( sub { "total NbObsThis $i=$nbObservedThisNGram +->[$i]; nbObsAll $i=$nbObservedAllNGrams->[$i]; total=$totalObservedA +ll; nbExpected $i=$nbExpectedThis[$i]; chisq = $chiSquare[$i]" } );
      which may be easier to bulk modify in source while maintaining existing log levels. (or not. YMMV.)

        ok, I didn't realize this advantage. thanks for the explanation!

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://925517]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2022-05-24 18:31 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (84 votes). Check out past polls.