You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Jardin Xavier <xj...@sofice.fr> on 2003/12/03 14:00:48 UTC

Log4j SMTP Appender Tomcat trouble

Hello,
I'm trying to use the SMTP Appender of log4j 1.2.8 with the following
configuration :
### Logger Mail ( SMTP Appender )
log4j.logger.Mail=DEBUG, Mail
log4j.appender.Mail=org.apache.log4j.net.SMTPAppender
log4j.appender.Mail.BufferSize=4096
log4j.appender.Mail.From=zzzzzz
log4j.appender.Mail.To=zzzzz@zzzz.zz
log4j.appender.Mail.Subject=zzzzzzzz
log4j.appender.Mail.SMTPHost=zzzzzz.zzzz.zzz
log4j.appender.Mail.layout=org.apache.log4j.SimpleLayout
log4j.appender.Mail.layout=org.apache.log4j.PatternLayout
log4j.appender.Mail.layout.ConversionPattern=%d[%c{1}i %x] %m%n
under Eclipse using a simple test class I receive the mail. When I try to do
the same under Tomcat 4.1.29 / JDK 1.4 nothing append : no mail, no dump. I
use the same mail.jar ( the jar is in WEB-INF/lib for Tomcat ) on both test
case.
Please advise,
Regards,
Jardin Xavier.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: Log4j SMTP Appender Tomcat trouble

Posted by Jardin Xavier <xj...@sofice.fr>.
I have removed from WEB-INF/lib the mail.jar, you're right it was already in
CATALINA_HOME\common\lib but this modification has no effect.
Log4j is configured using a properties file pass to the
PropertyConfigurator.configure(.) method. The file is located in the Tomcat
CATALINA_HOME\conf folder and all the different logger give me an output
except the mail logger. The additivity of the mail logger is true so I have
the message on the console but no mail under TomCat.

Xavier.

----- Original Message -----
From: "Jacob Kjome" <ho...@visi.com>
To: "Log4J Users List" <lo...@jakarta.apache.org>
Sent: Wednesday, December 03, 2003 2:42 PM
Subject: Re: Log4j SMTP Appender Tomcat trouble


>
> mail.jar shouldn't be in WEB-INF/lib as it is an endorsed library
(anything
> java.* javax.*, org.xml.*, org.w3c.dom.*).  Put it in
> CATALINA_HOME/common/lib or endorsed.  This allows Tomcat to use the mail
> api as well as your apps and will avoid troubles when/if the JDK actually
> includes the mail api (does the J2EE jar include it?). Of course, this
> probably isn't your immediate problem.
>
> Is Log4j getting configured under Tomcat for you?  That is, are you
getting
> output in other appenders?  If not, get that going first, and then try to
> get the Mail appender working.  Where is
> log4j.properties?  WEB-INF/classes?  Are you configuring it manually?  It
> may have been in the classpath of your IDE, but not of your webapp.  Just
> things to check out.
>
> Jake
>
> At 02:00 PM 12/3/2003 +0100, you wrote:
> >Hello,
> >I'm trying to use the SMTP Appender of log4j 1.2.8 with the following
> >configuration :
> >### Logger Mail ( SMTP Appender )
> >log4j.logger.Mail=DEBUG, Mail
> >log4j.appender.Mail=org.apache.log4j.net.SMTPAppender
> >log4j.appender.Mail.BufferSize=4096
> >log4j.appender.Mail.From=zzzzzz
> >log4j.appender.Mail.To=zzzzz@zzzz.zz
> >log4j.appender.Mail.Subject=zzzzzzzz
> >log4j.appender.Mail.SMTPHost=zzzzzz.zzzz.zzz
> >log4j.appender.Mail.layout=org.apache.log4j.SimpleLayout
> >log4j.appender.Mail.layout=org.apache.log4j.PatternLayout
> >log4j.appender.Mail.layout.ConversionPattern=%d[%c{1}i %x] %m%n
> >under Eclipse using a simple test class I receive the mail. When I try to
do
> >the same under Tomcat 4.1.29 / JDK 1.4 nothing append : no mail, no dump.
I
> >use the same mail.jar ( the jar is in WEB-INF/lib for Tomcat ) on both
test
> >case.
> >Please advise,
> >Regards,
> >Jardin Xavier.
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org


Re: Log4j SMTP Appender Tomcat trouble

Posted by Jacob Kjome <ho...@visi.com>.
mail.jar shouldn't be in WEB-INF/lib as it is an endorsed library (anything 
java.* javax.*, org.xml.*, org.w3c.dom.*).  Put it in 
CATALINA_HOME/common/lib or endorsed.  This allows Tomcat to use the mail 
api as well as your apps and will avoid troubles when/if the JDK actually 
includes the mail api (does the J2EE jar include it?). Of course, this 
probably isn't your immediate problem.

Is Log4j getting configured under Tomcat for you?  That is, are you getting 
output in other appenders?  If not, get that going first, and then try to 
get the Mail appender working.  Where is 
log4j.properties?  WEB-INF/classes?  Are you configuring it manually?  It 
may have been in the classpath of your IDE, but not of your webapp.  Just 
things to check out.

Jake

At 02:00 PM 12/3/2003 +0100, you wrote:
>Hello,
>I'm trying to use the SMTP Appender of log4j 1.2.8 with the following
>configuration :
>### Logger Mail ( SMTP Appender )
>log4j.logger.Mail=DEBUG, Mail
>log4j.appender.Mail=org.apache.log4j.net.SMTPAppender
>log4j.appender.Mail.BufferSize=4096
>log4j.appender.Mail.From=zzzzzz
>log4j.appender.Mail.To=zzzzz@zzzz.zz
>log4j.appender.Mail.Subject=zzzzzzzz
>log4j.appender.Mail.SMTPHost=zzzzzz.zzzz.zzz
>log4j.appender.Mail.layout=org.apache.log4j.SimpleLayout
>log4j.appender.Mail.layout=org.apache.log4j.PatternLayout
>log4j.appender.Mail.layout.ConversionPattern=%d[%c{1}i %x] %m%n
>under Eclipse using a simple test class I receive the mail. When I try to do
>the same under Tomcat 4.1.29 / JDK 1.4 nothing append : no mail, no dump. I
>use the same mail.jar ( the jar is in WEB-INF/lib for Tomcat ) on both test
>case.
>Please advise,
>Regards,
>Jardin Xavier.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org