geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: SMTPAppender in server-log4j.properties
Date Fri, 08 Feb 2008 05:34:08 GMT
I'm not sure if any of the people who have tried this have succeeded.

I think you will not be able to get the javamail classes into the  
log4j classloader.

You might have better luck trying to add the smtp appender in code  
from a geronimo configuration that does include the javamail  
classes.  You might be able to use hidden-classes to exclude the  
original log4j smtp appender class and reload it in your  
configuration, thus letting it be created without a NCDFE.  I'm not  
sure how you would arrange the configuration for this appender: IIRC  
there is some kind of programmatic interface you can use.

thanks
david jencks

On Feb 7, 2008, at 5:32 PM, N Z wrote:

> I would like to be able to send errors to my email when they occur  
> but I cannot seem to get it to work. I have the following  
> configuration in the properties file.
>
> log4j.rootLogger=INFO, CONSOLE, FILE, MAIL
>
> log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
> log4j.appender.CONSOLE.Threshold=$ 
> {org.apache.geronimo.log.ConsoleLogLevel}
> log4j.appender.CONSOLE.Target=System.out
> log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
> log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [% 
> c{1}] %m%n
>
> log4j.appender.FILE=org.apache.log4j.RollingFileAppender
> log4j.appender.FILE.Threshold=TRACE
> log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
> log4j.appender.FILE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c 
> {1}] %m%n
>
> #email appender
> log4j.appender.MAIL=org.apache.log4j.net.SMTPAppender
> #defines how othen emails are send
> log4j.appender.MAIL.BufferSize=1
> log4j.appender.MAIL.SMTPHost="smtp.gmail.com"
> log4j.appender.MAIL.From=log@gmail.com
> log4j.appender.MAIL.To=nzender1986@gmail.com
> log4j.appender.MAIL.Subject=Log ...
> log4j.appender.MAIL.threshold=error
> log4j.appender.MAIL.layout=org.apache.log4j.PatternLayout
> log4j.appender.MAIL.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}: 
> %L - %m%n
>
> But I get the following error
>
> 19:32:54,828 ERROR [GBeanInstanceState] Error while starting; GBean  
> is now in the FAILED state:  
> abstractName="org.apache.geronimo.configs/j2ee-system/2.0.2/car? 
> ServiceModule=org.apache.geronimo.configs/j2ee-system/2.0.2/ 
> car,j2eeType=SystemLog,name=Logger"
> java.lang.NoClassDefFoundError: javax/mail/Multipart
>     at java.lang.Class.getDeclaredConstructors0(Native Method)
>     at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
>     at java.lang.Class.getConstructor0(Unknown Source)
>     at java.lang.Class.newInstance0(Unknown Source)
>     at java.lang.Class.newInstance(Unknown Source)
>     at  
> org.apache.log4j.helpers.OptionConverter.instantiateByClassName 
> (OptionConverter.java:329)
>     at org.apache.log4j.helpers.OptionConverter.instantiateByKey 
> (OptionConverter.java:120)
>     at org.apache.log4j.PropertyConfigurator.parseAppender 
> (PropertyConfigurator.java:629)
>     at org.apache.log4j.PropertyConfigurator.parseCategory 
> (PropertyConfigurator.java:612)
>     at org.apache.log4j.PropertyConfigurator.configureRootCategory 
> (PropertyConfigurator.java:509)
>     at org.apache.log4j.PropertyConfigurator.doConfigure 
> (PropertyConfigurator.java:415)
>     at org.apache.log4j.PropertyConfigurator.doConfigure 
> (PropertyConfigurator.java:441)
>     at  
> org.apache.geronimo.system.logging.log4j.URLConfigurator.doConfigure 
> (URLConfigurator.java:117)
>     at  
> org.apache.geronimo.system.logging.log4j.URLConfigurator.configure 
> (URLConfigurator.java:44)
>     at  
> org.apache.geronimo.system.logging.log4j.Log4jService.reconfigure 
> (Log4jService.java:532)
>     at org.apache.geronimo.system.logging.log4j.Log4jService.doStart 
> (Log4jService.java:586)
>     at  
> org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance 
> (GBeanInstance.java:996)
>     at  
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart( 
> GBeanInstanceState.java:268)
>     at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start 
> (GBeanInstanceState.java:102)
>     at  
> org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive 
> (GBeanInstanceState.java:124)
>     at  
> org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive 
> (GBeanInstance.java:553)
>     at  
> org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean 
> (BasicKernel.java:379)
>     at  
> org.apache.geronimo.kernel.config.ConfigurationUtil.startConfiguration 
> GBeans(ConfigurationUtil.java:448)
>     at  
> org.apache.geronimo.kernel.config.ConfigurationUtil.loadBootstrapConfi 
> guration(ConfigurationUtil.java:200)
>     at  
> org.apache.geronimo.kernel.config.ConfigurationUtil.loadBootstrapConfi 
> guration(ConfigurationUtil.java:159)
>     at  
> org.apache.geronimo.kernel.util.MainConfigurationBootstrapper.loadBoot 
> Configuration(MainConfigurationBootstrapper.java:84)
>     at  
> org.apache.geronimo.kernel.util.MainConfigurationBootstrapper.getMain( 
> MainConfigurationBootstrapper.java:57)
>     at  
> org.apache.geronimo.kernel.util.MainConfigurationBootstrapper.main 
> (MainConfigurationBootstrapper.java:38)
>     at org.apache.geronimo.cli.AbstractCLI.executeMain 
> (AbstractCLI.java:67)
>     at org.apache.geronimo.cli.daemon.DaemonCLI.main(DaemonCLI.java: 
> 30)
>
>
> I have tried to add the javamail.jar to the j2ee-system/Meta-Inf/ 
> Manifest.MF file. But still to no luck. I have also put the  
> javamail.jar into the repository and that still does nothing.  
> Please any help would be very much appreciated.
> Thank you,
> Nathan


Mime
View raw message