logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Takacs Bence <be...@watt22.hu>
Subject Re: problems with SMTPAppender under tomcat
Date Fri, 11 Aug 2006 15:48:36 GMT
Hello

 > If you don't want that to happen then you can use
 > separate configs per project
I thought, this is what theese lines do in properties file:
log4j.logger.hu.watt22.wde22.cc=DEBUG, logfile
log4j.logger.hu.watt22.wde22.cc=DEBUG, zeroconf
log4j.logger.hu.watt22.wde22.ctransfer=DEBUG, logfile
log4j.logger.hu.watt22.wde22.ctransfer=ERROR, mail
log4j.logger.hu.watt22.nowision.test=DEBUG, logfile
(where 'logfile', 'zeroconf' and 'mail' mean different appenders and 
configs)

I used theese settings. Is there any other way to make different configs 
for different projects?

Or this don't do the thing?

Thanks:
	Bence


James Stauffer wrote:
> Yes. When log4j is configured, it configures all of itself so it of
> course needs to be able to configure every appender.  I suppose it
> could be made to configure appender lazily but it doesn't.  It isn't
> really weird.  If you don't want that to happen then you can use
> separate configs per project.  If you want all projects to use the
> same config then you are grouping them together logically.
> 
> (Note the spelling of "project".)
> 
> On 8/11/06, Takacs Bence <bence@watt22.hu> wrote:
>> Hello
>>
>> The projekt uses the configuration, but has no SMPTAppender attached to
>> it. You mean, that if it use a config in which I call an appender: every
>> package I use should meet the requirements of that appender?
>>
>> This would mean that all my projects would use the mail.api and
>> activation.jar because I attached the SMTPAppender to one of them.
>>
>> This would be weird.
>>
>> Thanks:
>>         Bence
>>
>>
>>
>> James Stauffer wrote:
>> > If a project that doesn't need to send email uses a log4j config that
>> > includes an SMPTAppender log4j still needs to configure that appender
>> > so it needs mail.jar and activation.jar.
>> > You don't want to have 2 copies of the same jar in the classpath twice.
>> >
>> > On 8/11/06, Takacs Bence <bence@watt22.hu> wrote:
>> >> Hello
>> >>
>> >> I've found a solution on the net:
>> >> Deleted all tomcat projects includes the mail.jar, and copied the
>> >> mail.jar and activation.jar to the /tomcat/shared/lib, and everything
>> >> looks fine.
>> >>
>> >> But WHY???
>> >> It has solved the problem, but it's not a real solution. The problem
>> >> remained unrevealed. My questions:
>> >>
>> >> - Why does a package , which doesn't need to send a mail throws an
>> >> AddressException
>> >> - Why is it problem if I have different projects with mail.jar, and
>> >> activation.jar? And how can I use them regularly (without exceptions)?
>> >>
>> >> Any ideas?
>> >>
>> >> Thanks:
>> >>     Bence
>> >>
>> >>
>> >> Takacs Bence wrote:
>> >> > Greetings
>> >> >
>> >> > I've been using log4j for a couple of weeks with tapestry 
>> framework, on
>> >> > tomcat. [We've been using tapestry and tomcat for a year] It was
>> >> working
>> >> > properly, until I attached the SMTPAppender to a tapestry projekt.
>> >> > An other projekt throws the following exception:
>> >> > org.apache.commons.logging.LogConfigurationException:
>> >> > java.lang.NoClassDefFoundError: javax/mail/internet/AddressException
>> >> > (Caused by java.lang.NoClassDefFoundError:
>> >> > javax/mail/internet/AddressException)
>> >> > But that projekt would not need to send email... I don't 
>> understand...
>> >> >
>> >> > I attached the SMTPAppender to projekt cc, and the eTransferManager
>> >> > throws the exception.
>> >> >
>> >> > And in addition: the attached projekt (cc) works , and sends 
>> email if I
>> >> > call the logger.error() method despite the fact that I haven't 
>> put the
>> >> > mail.jar, and activation jar into it...
>> >> > And the other projekt doesn't start.
>> >> >
>> >> > If I comment out the line I call the SMTP appender, they are working
>> >> > properly. (but no email...)
>> >> >
>> >> > Does anybody has any idea, what's the problem?
>> >> > Thanks fore the help
>> >> >
>> >> > here is the properties file:
>> >> >
>> >> > # root:
>> >> > log4j.rootLogger=ERROR, stdout
>> >> >
>> >> > # packages:
>> >> > log4j.logger.hu.watt22.wde22.cc=DEBUG, logfile
>> >> > log4j.logger.hu.watt22.wde22.cc=ERROR, mail
>> >> > log4j.logger.hu.watt22.wde22.ctransfer=DEBUG, logfile
>> >> > log4j.logger.hu.watt22.nowision.test=DEBUG, logfile
>> >> >
>> >> > # stdout -- Console Appender
>> >> > log4j.appender.stdout=org.apache.log4j.ConsoleAppender
>> >> > log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
>> >> > log4j.appender.stdout.layout.ConversionPattern=%d{HH:mm:ss,SSS} [%t]
>> >> %5p
>> >> > (%F:%L) - %m%n
>> >> >
>> >> > # logfile -- DailyRollingFileAppender
>> >> > log4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender
>> >> > log4j.appender.logfile.File=${catalina.home}/myLogs/client.log
>> >> > log4j.appender.logfile.DatePattern='.'yyyy-MM-dd
>> >> >
>> >> > # logfile Layout
>> >> > log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
>> >> > log4j.appender.logfile.layout.ConversionPattern=%d{HH:mm:ss,SSS} %5p
>> >> > (%F:%L) - %m%n
>> >> >
>> >> > # mail -- SMTPAppender
>> >> > log4j.appender.mail=org.apache.log4j.net.SMTPAppender
>> >> > log4j.appender.mail.To=b.takacs@watt22.hu
>> >> > log4j.appender.mail.From=error@watt22.hu
>> >> > log4j.appender.mail.SMTPHost=mail.watt22hq.hu
>> >> > #log4j.appender.mail.Threshold=ERROR
>> >> > log4j.appender.mail.BufferSize=512
>> >> > log4j.appender.mail.Subject=WDE Application Error
>> >> > log4j.appender.mail.layout=org.apache.log4j.PatternLayout
>> >> > log4j.appender.mail.layout.ConversionPattern=[%p] %d{DATE} %c - %m%n
>> >> >
>> >> >
>> >> > ...and the whole exception:
>> >> >
>> >> > Aug 10, 2006 4:56:25 PM org.apache.catalina.startup.HostConfig
>> >> deployWAR
>> >> > SEVERE: Error deploying web application archive eTransferManager.war
>> >> > org.apache.commons.logging.LogConfigurationException:
>> >> > java.lang.NoClassDefFoundError: javax/mail/internet/AddressException
>> >> > (Caused by java.lang.NoClassDefFoundError:
>> >> > javax/mail/internet/AddressException)
>> >> >        at
>> >> >
>> >> 
>> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:538)

>>
>> >>
>> >> >
>> >> >        at
>> >> >
>> >> 
>> org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)

>>
>> >>
>> >> >
>> >> >        at
>> >> org.apache.commons.logging.LogFactory.getLog(LogFactory.java:370)
>> >> >        at
>> >> >
>> >> 
>> org.apache.catalina.core.ContainerBase.getLogger(ContainerBase.java:380)
>> >> >        at
>> >> >
>> >> 
>> org.apache.catalina.core.StandardContext.start(StandardContext.java:4090)
>> >> >        at
>> >> >
>> >> 
>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) 
>>
>> >>
>> >> >
>> >> >        at
>> >> > 
>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
>> >> >        at
>> >> > 
>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
>> >> >        at
>> >> > 
>> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:809)
>> >> >        at
>> >> > 
>> org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:698)
>> >> >        at
>> >> > 
>> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
>> >> >        at
>> >> > org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
>> >> >        at
>> >> >
>> >> 
>> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310) 
>>
>> >>
>> >> >        at
>> >> >
>> >> 
>> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)

>>
>> >>
>> >> >
>> >> >        at
>> >> > 
>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
>> >> >        at
>> >> > org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
>> >> >        at
>> >> > 
>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
>> >> >        at
>> >> > 
>> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
>> >> >        at
>> >> >
>> >> 
>> org.apache.catalina.core.StandardService.start(StandardService.java:450)
>> >> >        at
>> >> > 
>> org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
>> >> >        at 
>> org.apache.catalina.startup.Catalina.start(Catalina.java:551)
>> >> >        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
>> Method)
>> >> >        at
>> >> >
>> >> 
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
>>
>> >>
>> >> >
>> >> >        at
>> >> >
>> >> 
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

>>
>> >>
>> >> >
>> >> >        at java.lang.reflect.Method.invoke(Method.java:585)
>> >> >        at
>> >> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
>> >> >        at
>> >> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
>> >> > Caused by: java.lang.NoClassDefFoundError:
>> >> > javax/mail/internet/AddressException
>> >> >        at java.lang.Class.getDeclaredConstructors0(Native Method)
>> >> >        at
>> >> java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
>> >> >        at java.lang.Class.getConstructor0(Class.java:2640)
>> >> >        at java.lang.Class.newInstance0(Class.java:321)
>> >> >        at java.lang.Class.newInstance(Class.java:303)
>> >> >        at
>> >> >
>> >> 
>> org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:319)

>>
>> >>
>> >> >
>> >> >        at
>> >> >
>> >> 
>> org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:112)

>>
>> >>
>> >> >
>> >> >        at
>> >> >
>> >> 
>> org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:620)

>>
>> >>
>> >> >
>> >> >        at
>> >> >
>> >> 
>> org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:603)

>>
>> >>
>> >> >
>> >> >        at
>> >> >
>> >> 
>> org.apache.log4j.PropertyConfigurator.parseCatsAndRenderers(PropertyConfigurator.java:524)

>>
>> >>
>> >> >
>> >> >        at
>> >> >
>> >> 
>> org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:408)

>>
>> >>
>> >> >
>> >> >        at
>> >> >
>> >> 
>> org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:432)

>>
>> >>
>> >> >
>> >> >        at
>> >> >
>> >> 
>> org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:460)

>>
>> >>
>> >> >
>> >> >        at org.apache.log4j.LogManager.<clinit>(LogManager.java:113)
>> >> >        at org.apache.log4j.Logger.getLogger(Logger.java:85)
>> >> >        at
>> >> >
>> >> 
>> org.apache.commons.logging.impl.Log4JLogger.getLogger(Log4JLogger.java:229) 
>>
>> >>
>> >> >        at
>> >> > 
>> org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:65)
>> >> >        at 
>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>> >> > Method)
>> >> >        at
>> >> >
>> >> 
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

>>
>> >>
>> >> >
>> >> >        at
>> >> >
>> >> 
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

>>
>> >>
>> >> >
>> >> >        at
>> >> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>> >> >        at
>> >> >
>> >> 
>> org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)

>>
>> >>
>> >> >
>> >> >        ... 26 more
>> >> >
>> >> > Thanks:
>> >> >    Bence
>> >> >
>> >> >
>> >> > 
>> ---------------------------------------------------------------------
>> >> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> >> > For additional commands, e-mail: log4j-user-help@logging.apache.org
>> >> >
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> >> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> >>
>> >>
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>>
> 
> 


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


Mime
View raw message