I have upgraded to Log4perl 0.42, earlier I was doing development in Log4perl 0.31.
In 0.31, when I used Log::Log4perl::MDC->get("Userdata"), and if there is no value inserted for this key "Userdata", I got "[undef]" , but after upgrading it seems that when there is no value inserted for this key, it gives null and complains with an error mentioned below:
The example of code is:
if (isundefined(Log::Log4perl::MDC->get("Userdata")) { do somethng ....}
sub isundefined
{
my $p = shift;
if ($p eq "[undef]"){
return 1;}
else{
return 0; }
}
Error that get is
like "Use of uninitialized value in string eq at /sbcimp/run/pkgs/CORE/11.4.0/lib/Log/Netcool/SocketProbeAppender.pm line 312. followed by an error from PatternLayout "
Use of uninitialized value in sprintf at /sbcimp/run/pkgs/CORE/11.5.0/links/cpan/lib/Log/Log4perl/Layout/PatternLayout.pm line 285."
I have checked in the release document for 0.42 and couldn't find anything mentioning such a change.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have upgraded to Log4perl 0.42, earlier I was doing development in Log4perl 0.31.
In 0.31, when I used Log::Log4perl::MDC->get("Userdata"), and if there is no value inserted for this key "Userdata", I got "[undef]" , but after upgrading it seems that when there is no value inserted for this key, it gives null and complains with an error mentioned below:
The example of code is:
if (isundefined(Log::Log4perl::MDC->get("Userdata")) { do somethng ....}
sub isundefined
{
my $p = shift;
if ($p eq "[undef]"){
return 1;}
else{
return 0; }
}
Error that get is
like "Use of uninitialized value in string eq at /sbcimp/run/pkgs/CORE/11.4.0/lib/Log/Netcool/SocketProbeAppender.pm line 312. followed by an error from PatternLayout "
Use of uninitialized value in sprintf at /sbcimp/run/pkgs/CORE/11.5.0/links/cpan/lib/Log/Log4perl/Layout/PatternLayout.pm line 285."
I have checked in the release document for 0.42 and couldn't find anything mentioning such a change.