Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2017-04-23 10:16 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (430 votes). Check out past polls.