[Omaha.pm] Binary stuff in my logs (Log::Log4perl)

Sean Baker pbaker at omnihotels.com
Wed Sep 27 14:37:12 PDT 2006


Maybe you can tweak this somehow:

$current_level = $logger->level();

?

Sean Baker

-----Original Message-----
From: omaha-pm-bounces+pbaker=omnihotels.com at pm.org
[mailto:omaha-pm-bounces+pbaker=omnihotels.com at pm.org] On Behalf Of Jay
Hannah
Sent: Wednesday, September 27, 2006 4:13 PM
To: Perl Mongers of Omaha, Nebraska USA
Subject: Re: [Omaha.pm] Binary stuff in my logs (Log::Log4perl)


Log::Log4perl follow-up...

Hmmm... Now I'm wishing there was a way to ask a Log::Log4perl object if
there are any debug level listeners active.... What a waste of CPU if
debug() is being ignored...

j

 
# -----
# Send this to the debugger in case someone is listening...
# If there's binary crap in here don't write that to my logs.
# Instead, throw [ASCII:24] and the like to the logs.
#   Wow... This is a terrible loop if we ever send more than a 
#   few bytes of binary data through the engine!!
# -jhannah 2006-09-27
# -----
my $logable_buffer = $self->{buffer};
my $binary_char;
while (($binary_char) = ($logable_buffer =~ /([^ -~])/)) {
   my $ord = "[ASCII:" . ord($binary_char) . "]";
   $logable_buffer =~ s/\Q$binary_char\E/$ord/gs;
}
$logger->debug("My buffer is now $logable_buffer");

_______________________________________________
Omaha-pm mailing list
Omaha-pm at pm.org
http://mail.pm.org/mailman/listinfo/omaha-pm



More information about the Omaha-pm mailing list