Subject: | Seemingly 2 issues with tie::log4perl |
Date: | Fri, 19 Apr 2013 15:55:59 +0000 |
To: | "'bug-Tie-Log4perl [...] rt.cpan.org'" <bug-Tie-Log4perl [...] rt.cpan.org> |
From: | "Atlas, Zeev" <Zeev.Atlas [...] pimco.com> |
Good day
I was trying this code in both Windows and Linux:
[code]
#!/usr/bin/perl
use strict;
use warnings;
use Log::Log4perl;
use Tie::Log4perl; # It did not work whether this line was here or not
use Log::Dispatch::FileRotate ;
# Initialize Logger
my $log_conf = "/home/zatlas/tests/log4perl\.conf";
Log::Log4perl::init($log_conf);
my $logger = Log::Log4perl->get_logger('FW');
tie *STDERR, "Tie::Log4perl";
print STDERR "a STDERR message from main\n";
[/code]
Issue #1
When I did:
tie *STDERR, 'Tie::Log4perl';
Perl could not find TIEHANDLE
Issue #2
When I commented out:
#tie *STDERR, "Tie::Log4perl";
The message
a STDERR message from main
came to the screen
BUT, when the tie is in effect (not commented), the message did not come, neither to the screen, nor to the log file.
My configuration file:
[code]
###############################################################################
# Log::Log4perl Conf #
###############################################################################
log4perl.rootLogger = INFO, LOG1, SCREEN
log4perl.appender.SCREEN = Log::Log4perl::Appender::Screen
log4perl.appender.SCREEN.stderr = 0
log4perl.appender.SCREEN.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.SCREEN.layout.ConversionPattern = %m %n
SOME_DUMMY_VARIABLE = CRASH_LOGGER
#log4perl.appender.LOG1 = Log::Log4perl::Appender::File
log4perl.appender.LOG1 = Log::Dispatch::FileRotate
log4perl.appender.LOG1.filename = /home/zatlas/tests/mylog.log
#log4perl.appender.LOG1.filename = ${LOGPATH}/${LOGFILE}
log4perl.appender.LOG1.mode = append
log4perl.appender.LOG1.max = 5
log4perl.appender.LOG1.size = 5000000
log4perl.appender.LOG1.layout = Log::Log4perl::Layout::PatternLayout
log4perl.appender.LOG1.layout.ConversionPattern = %d %p %P %l %m %n
[/code]
What am I doing wrong?
Thank you
Ze'ev Atlas
This message contains confidential information and is intended only for the individual named. If you are not the named addressee, you should not disseminate, distribute, alter or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmissions cannot be guaranteed to be secure or without error as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender, therefore, does not accept liability for any errors or omissions in the contents of this message which arise during or as a result of e-mail transmission. If verification is required, please request a hard-copy version. This message is provided for information purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments in any jurisdiction.