Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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.

--
Andreas


Comment on Re^2: Strategy for conditional logging in tests
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2014-08-23 17:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (175 votes), past polls