Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^2: Strategy for conditional logging in tests

by andreas1234567 (Vicar)
on Apr 01, 2008 at 16:38 UTC ( #677787=note: print w/replies, xml ) Need Help??

in reply to Re: Strategy for conditional logging in tests
in thread Strategy for conditional logging in tests

I don't see that making it a module would make a difference. Please elaborate.
  • Comment on Re^2: Strategy for conditional logging in tests

Replies are listed 'Best First'.
Re^3: Strategy for conditional logging in tests
by Thilosophy (Curate) on Apr 02, 2008 at 04:30 UTC
    I agree that having your code as a module or not does not make a big difference here, but you should be able to "diddle the logging to appropriate levels in the .t". Is it not possible to turn off logging from the test script for your negative tests, and then turn it back on for the others?
      Well, I could always add functionality to toggle logging on or off and invoke it during tests, e.g. something simple like this:
      sub log_toggle { ($_[0]) ? Log::Log4perl->appender_thresholds_adjust(7) : Log::Log4perl->appender_thresholds_adjust(-7); }
      However I think it's inelegant to add functionality to the script that is going to be used during testing only. I would rather that the test script did that alone.
        Maybe there is something I do not understand about Log4Perl, but could you not call Log::Log4perl->appender_thresholds_adjust from within your test script? The whole point of a configurable logging framework seems to be that you can configure logging from outside of the code that does the actual logging.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://677787]
[karlgoethebier]: before i forget it: good morning

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2018-01-20 09:32 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (226 votes). Check out past polls.