in reply to log4perl run from within another package not firing messages sent through email
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: log4perl run from within another package not firing messages sent through email
by nysus (Parson) on Dec 03, 2015 at 20:00 UTC | |
by 1nickt (Canon) on Dec 04, 2015 at 12:01 UTC |