Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I have a bunch of utility scripts I'd like to test in part by scraping their log output. The scripts use Log::Dispatch with the default screen output and a file output for logging. Presently, the tests use Test::Trap to check log output on STDOUT.

This approach works well when proving tests directly from the command line. However, we run automated tests nightly via cron and under these conditions either Dispatch::Log doesn't write log entries (likely because STDOUT goes nowhere) or Test::Trap doesn't get them. I see the same results when running the tests with nohup prove ... --html

I'd rather not completely change the test approach (to reading the file, for example, instead of using Test::Trap) just because the logging tests fail under cron. On the other hand, we rely on the nightly test output to alert us to trouble and don't want a bunch of "known" failing results.

Supposing I can detect when running under cron (probably with ENV injection in the cron script that launches the tests--I've found checking PS1 is not sufficient to know) is there some UNIX or Perl hack I can use to persuade Log::Dispatch to log such that Test::Trap gets the lines?


In reply to Test::Trap + Log::Dispatch under Cron by Solo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2024-04-23 08:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found