Hi,
Previously, when on our old server, we used to be able to use this to print out to the perl_error_log (so we could track stuff in the code);
use Term::ANSIColor qw(:constants);
print STDERR RED, "foo \n", RESET;
..and then when the code was run, it would print out the word "foo" in the perl_error_log, but in red.
However, since we upgraded the server to a more powerful one (with the same host), and I believe to the latest versions of Perl + Apache, we have got a bit of a problem!
The logs now come up like:
[Fri Mar 11 03:22:43 2011] [error] [client 90.200.254.240] \x1b[32mSub foo\x1b[0m
Which is absolutly no use to us :(
Is there any way of getting this to work on the latest version of Perl + Apache? (maybe with another module?)
UPDATE - this is interesting! It works fine in a basic perl script, just not when being show in the perl_error_log :/
Maybe some "escaping" is being done in those log files? Right PITA if it does!!! I also wanna get rid of the timestamp stuff in the error log, but it seems like we can't :(
UPDATE 2: Never mind - I found a work around. Simply doing:
open (STDERR,">>/var/home/voyage/voyageforum.com/logs/custom_logs") || die $!;
..and then the output is placed perfectly into that file, colouring and all!
TIA!
Andy
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.