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