[log4perl-devel] Small issue with Log::Log4perl 1.15

2008-02-20 Thread Emil Janev
Hi,

With the latest version 1.15, in a specific scenario, warning messages
are printed on the standard error.
It was not happening with 1.14 and before.

Here is a test case:


$ cat tst_log.pl
#!/usr/bin/perl

use strict;
use Log::Log4perl qw(get_logger :levels);

my $config_file = 'logger.conf';

Log::Log4perl->init($config_file);

my $logger = get_logger(undef);

$logger->info('info_message_1');

exit;
$ tst_log.pl
Use of uninitialized value in string eq at
/usr/local/share/perl/5.8.8/Log/Log4perl.pm line 360.
Use of uninitialized value in string eq at
/usr/local/share/perl/5.8.8/Log/Log4perl/Logger.pm line 560.
$ cat t.log
2008/02/20 16:04:11 INFO> tst_log.pl:12 main:: - info_message_1
$


Test script and the configuration file are attached.

Aside the messages on the STDERR, functionality is not affected.

Thanks in advance,
Emil

-- 
Emil Janev
#!/usr/bin/perl

use strict;
use Log::Log4perl qw(get_logger :levels);

my $config_file = 'logger.conf';

Log::Log4perl->init($config_file);

my $logger = get_logger(undef);

$logger->info('info_message_1');

exit;


logger.conf
Description: Binary data
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
log4perl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/log4perl-devel


Re: [log4perl-devel] Small issue with Log::Log4perl 1.15

2008-02-20 Thread Mike Schilli
On Wed, 20 Feb 2008, Emil Janev wrote:

> my $logger = get_logger(undef);

That's an interesting case. While

  # get a logger for the current package
get_logger()

and

  # get the root logger
get_logger("")

are defined cases, using 'undef' as in

get_logger( undef )

isn't defined. There was a change in 1.15 that now brings this undefined
behavior to light (unfortunately for you :).

If you want to use a variable to toggle between "" and the empty list,
use an array:

my @array = ();
my $logger = get_logger(@array);

# vs.

my @array = ("");
my $logger = get_logger(@array);

Does that work for you?

-- Mike

Mike Schilli
[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
log4perl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/log4perl-devel