logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clemens Eisserer" <linuxhi...@gmail.com>
Subject Re: Log4j Web-Deployment best practices question
Date Tue, 21 Mar 2006 18:10:51 GMT
To be honest I am quite a bit shocked nobody replied how ugly this
method is and why I should avoid it under any circumstances ;)
No, just hoped to get some suggestions which could lead to a better
solution but its not fair to ask on Log4J's list about problems cause
by commons-logging...

lg Clemens

2006/3/18, Clemens Eisserer <linuxhippy@gmail.com>:
> This is just what I did to workarround the problem since I had similar
> problems with commons-logging/log4j under tomcat:
>
> I just renamed the package which contains log4j - therefor creating my
> own fork of Log4J with the only difference that instead of using log4j
> as package name - i used log4p.
> It now also works at the shared tomcat instance of a cheap hoster.
>
> Its a dirty hack and ugly since you need to do it wor every new
> version of log4j but it works and is done in 5min.
>
> lg Clemens
>
> 2006/3/10, Jeff Bischoff <jbischoff@klkurz.com>:
> > Yes, but then I am not "playing nice" with the other web applications
> > running on that Tomcat server?
> >
> > James Stauffer wrote:
> > > You could setup Tomcat to have common/lib/log4j.jar and
> > > common/classes/log4j.xml.
> > > Then the same war should work for both Tomcat and JBoss.
> > >
> > > On 3/10/06, Jeff Bischoff <jbischoff@klkurz.com> wrote:
> > >
> > >>I have been using Log4j for the past several months. After reading the
> > >>documentation and the mailing list archives, I am still a bit puzzled
> > >>about the best practices for deploying web-apps that use Log4j.
> > >>
> > >>What I would like to have is a .WAR file for my website that can be
> > >>deployed to either Tomcat or JBoss, without modification. Unfortunately
> > >>it seems that the classloaders of these two servers function a bit
> > >>differently...
> > >>
> > >>With Tomcat, I understand that the best practice is to provide your own
> > >>copy of log4j.jar and configuration files inside your WEB-INF folder.
> > >>
> > >>In JBOSS, however, log4j.jar is included by default in the shared /lib/
> > >>folder. If I so much as put an (identical) copy of log4j.jar in my
> > >>/WEB-INF/lib/ folder, JBOSS throws exceptions while deploying my
> > >>application, and logging fails. (The exception message is at the end of
> > >>this email)
> > >>
> > >>I am currently building my WAR file with no log4j.jar, nor log4j
> > >>configuration files, and deploying successfully to JBoss (modifying the
> > >>default configuration file in JBoss). Unfortunately, now if I want to
> > >>use standalone Tomcat, I have to add things to my WAR file, before I can
> > >>deploy it.
> > >>
> > >>I have considered switching to commons-logging as a wrapper to log4j (a
> > >>trivial conversion). Unfortunately, from what I have read, I will run
> > >>into the same problems with classloading.
> > >>
> > >>14:54:59,312 INFO  [STDOUT] log4j:ERROR A
> > >>"org.jboss.logging.util.OnlyOnceErrorHandler" object is not assignable
> > >>to a "org.apache.log4j.spi.ErrorHandler" variable.
> > >>14:54:59,312 INFO  [STDOUT] log4j:ERROR The class
> > >>"org.apache.log4j.spi.ErrorHandler" was loaded by
> > >>14:54:59,312 INFO  [STDOUT] log4j:ERROR [WebappClassLoader
> > >>   delegate: false
> > >>   repositories:
> > >>     /WEB-INF/classes/
> > >>----------> Parent Classloader:
> > >>java.net.FactoryURLClassLoader@d9799d
> > >>] whereas object of type
> > >>14:54:59,312 INFO  [STDOUT] log4j:ERROR
> > >>"org.jboss.logging.util.OnlyOnceErrorHandler" was loaded by
> > >>[org.jboss.system.server.NoAnnotationURLClassLoader@ab95e6].
> > >>14:54:59,359 INFO  [STDOUT] log4j:ERROR Could not create an Appender.
> > >>Reported error follows.
> > >>14:54:59,359 INFO  [STDOUT] java.lang.ClassCastException:
> > >>org.jboss.logging.appender.DailyRollingFileAppender
> > >>...(stack trace follows)
> > >>
> > >>- Jeff Bischoff
> > >>
> > >>
> > >>
> > >>
> > >>---------------------------------------------------------------------
> > >>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > >>For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >>
> > >>
> > >
> > >
> > >
> > > --
> > > James Stauffer
> > > Are you good? Take the test at http://www.livingwaters.com/good/
> > >
> > > ---------------------------------------------------------------------
> > > 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