From: Jose V. N. Z. <jo...@ne...> - 2002-09-18 18:36:49
|
First of all thanks for this cool port of the Log4j API; This tool is goi= ng to make our lives easier :) So far i managed to add the logging functionality to my application (part= of my perl code): use constant OK_CODE =3D> 0; use constant ERROR_CODE =3D> 1; use constant LOG_CONFIG =3D> "/usr/local/sysadmin/VeronicadLog4perl.prope= rties"; use constant REFRESH_LOG_CONFIG =3D> 300; # ----- END User configurable parameters -------- # Start the logger Log::Log4perl->init_and_watch(LOG_CONFIG, REFRESH_LOG_CONFIG); my $logger =3D get_logger("Veronicad"); $logger->error("Testing errors"); And here is my configuration file info with three appenders: log4perl.logger.Veronicad=3DDEBUG, syslog, screen, mail log4perl.appender.screen=3DLog::Dispatch::Screen log4perl.appender.screen.stderr=3D0 log4perl.appender.screen.layout=3DLog::Log4perl::Layout::PatternLayout log4perl.appender.screen.layout.ConversionPattern=3D%d %p> %F{1}:%L %M - = %m%n log4perl.appender.syslog=3DLog::Dispatch::Syslog log4perl.appender.syslog.name=3DVeronicad log4perl.appender.syslog.facility=3Ddaemon log4perl.appender.syslog.socket=3Dinet log4perl.appender.syslog.layout=3DLog::Log4perl::Layout::PatternLayout log4perl.appender.syslog.layout.ConversionPattern=3D%d %p> %F{1}:%L %M - = %m%n log4perl.appender.mail=3DLog::Dispatch::Email::MailSend log4perl.appender.mail.name=3DVeronicad log4perl.appender.mail.subject=3DVeronicad event log4perl.appender.mail.to=3D...@em...dress log4perl.appender.mail.from=3D...@em...dress log4perl.appender.mail.buffered=3D0 log4perl.appender.mail.server=3Dmy.mail.server <--- NOT SURE ABOUT THIS!= !!!!! log4perl.appender.mail.layout=3DLog::Log4perl::Layout::PatternLayout log4perl.appender.mail.layout.ConversionPattern=3D%d %p> %F{1}:%L %M - %m= %n But the application doesn't sends an email when i got an error (just runs= without sending the email): bash-2.04# ./Veronicad.pl=20 2002/09/18 14:36:16 ERROR> Veronicad.pl:34 main:: - Testing errors 2002/09/18 14:36:16 INFO> Veronicad.pl:45 main:: - [Server ./Veronicad.pl= accepting clients] So far reading the man page i found that "Log::Dispatch::Email::MailSend"= is a subclass of 'Mail::Send' wich also inherits from 'Mail::Mailer'. 'Mail::Mailer' can specify to use an external SMTP s= erver like this: ""smtp"" Use the "smtp" protocol via Net::SMTP to deliver the mail. The server to use can be specified in "@args" with $mailer =3D new Mail::Mailer 'smtp', Server =3D> $server; The smtp mailer does not handle "Cc" and "Bcc" lines, neither their "Resent-*" fellows. The "Debug" options enables debugging output from "Net::SMTP". How i can achieve the same using 'Log::Dispatch::Email::MailSend' class? There is a environment variable i can set so i can force the ussage of th= is SMTP server? There is a way to debug if this is working? I can send email using the external mail server using Net::SMTP and that = class is already installed on my system. Thanks in advance, Jose Vicente. --=20 Jos=E9 Vicente N=FA=F1ez Zuleta Newbreak LLC System Administrator (http://www.newbreak.com) Phone: 203-355-1511, 203-355-1510 Fax: 203-355-1512 |