[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Omaha.pm] Binary stuff in my logs (Log::Log4perl)
if($logger->is_debug()) {...} ???
-----Original Message-----
From: omaha-pm-bounces+andrew.hadenfeldt=alltel.com@pm.org
[mailto:omaha-pm-bounces+andrew.hadenfeldt=alltel.com@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@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.