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

Andrew.Hadenfeldt at alltel.com Andrew.Hadenfeldt at alltel.com
Wed Sep 27 14:40:05 PDT 2006


if($logger->is_debug()) {...} ???

-----Original Message-----
From: omaha-pm-bounces+andrew.hadenfeldt=alltel.com at pm.org
[mailto:omaha-pm-bounces+andrew.hadenfeldt=alltel.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

******************************************************************************************
The information contained in this message, including attachments, may contain 
privileged or confidential information that is intended to be delivered only to the 
person identified above. If you are not the intended recipient, or the person 
responsible for delivering this message to the intended recipient, Alltel requests 
that you immediately notify the sender and asks that you do not read the message or its 
attachments, and that you delete them without copying or sending them to anyone else. 




More information about the Omaha-pm mailing list