Love this module but first thing I noticed was incorrect handling with
logconfess. I checked out the source and I think I see the reason
explained below. 

Bug Description:
Calling logconfess(); only prints and records the log message passed to
logconfess() and the initiator of my module.

Setup:
Test.pl script which uses my test.pm module. My module uses the
Log::Log4perl module and calls it from my module inside a sub routine.
But the exact order of calls is:
1. test.pl runs
2. test.pl uses test.pm
3. test.pl calls $t = test->new();
4. test.pm uses Log::Log4perl
5. test->new calls test->init() where Log::Log4perl gets initialized via
Log::Log4perl->init("log.conf");
6. test.pl then calls $t->blah()
7. test->blah() does $l = get_logger("test")
8. test->blah() calls $l->logconfess('testing logconfess')

Result Is:
Message in log is params on left + "testing logconfess" at ./test.pl
line 8

Expected Result:
Message in log should be params on left + "testing logconfess at test.pm
line x \n test::blah('hash value') called at ./test.pl line 8"

I was testing out the error levels and how the messages looked before
implementing this in my projects and I stumbled across this. I wrote my
own logging module before and had issues with longmess() and shortmess()
in carp. I think it's a little tricky dealing with the frame levels. I
noticed that logcluck() works fine. So in the source I noticed that the
main difference was how $Carp::CarpLevel was being set. In the cluck
call its set like: 
$Carp::CarpLevel = $Carp::CarpLevel + 1;
And in the confess call its set like:
local $Carp::CarpLevel = 2;
I patched my local copy to the way the logcluck is setting the
$Carp::CarpLevel and my messages are as expected.

Another thing I noticed is that doing a print Carp::longmess after
calling get_logger will also cause this error. But if I comment out the
get_logger call and print Carp::longmess it works as expected.

Hope this makes it to the right people so the package can be updated. I
love it so far. Writing your own logging module really is a right of
passage in perl but what a waste of time when there are modules like
this around!

Thanks,
------------------------------------------
Ali Mesdaq
Security Researcher II
Websense Security Labs
http://www.WebsenseSecurityLabs.com
------------------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
log4perl-devel mailing list
log4perl-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/log4perl-devel

Reply via email to