Found the problem with some help from the FAQ at http://search.cpan.org/dist/Log-Log4perl-1.30/lib/Log/Log4perl/FAQ.pm#How_can_I_configure_Log::Log4perl_to_send_me_email_if_something_happens
Apparently, there is some buffering going on so emails do not get sent out immediately until some threshold for the number of messages generated is reached. Though it's still a mystery to me as to why emails are sent immediately when the code is in the main package.
So here is the code that works with the buffered property set to 0:
my $appender_email = Log::Log4perl::Appender->new( "Log::Dispatch::Email::SSMTP", threshold => "INFO", to => 'me@mymail.com', buffered => 0, subject => 'Perl script message' );
$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon";
$nysus = $PM . $MCF;
Click here if you love Perl Monks
In reply to Re: log4perl run from within another package not firing messages sent through email
by nysus
in thread log4perl run from within another package not firing messages sent through email
by nysus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |