You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Dmitry Skavish <ds...@ptc.com> on 2002/03/01 17:57:41 UTC

some issue with reloading

hello all,

I use log4j from servlets as well as jsp and just yesterday I encountered some
very annoying problem. If I replace my servlet jar without restarting servlet engine
(resin in this case) log4j prints the following errors and refuses to work:

log4j:WARN Failed to set property [conversionPattern] to value "%d [%p] - %m%n". object is not an instance of declaring class
log4j:WARN Failed to set property [file] to value "/home/jzox/log/generator.log". object is not an instance of declaring class
log4j:WARN Failed to set property [maxFileSize] to value "100KB". object is not an instance of declaring class
log4j:WARN Failed to set property [maxBackupIndex] to value "20". object is not an instance of declaring class
log4j:WARN File option not set for appender [R].
log4j:WARN Are you using FileAppender instead of ConsoleAppender?
log4j:ERROR No output stream or file set for the appender named [S].

I believe this because classloader loads new classes which don't match the old ones.
anyway it would be nice to have some workaround or fix for it.
thanks!

-- 
Dmitry Skavish
-----------------------
Boston, MA, USA
tel. +1 781 370-6909
http://www.flashgap.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: some issue with reloading

Posted by Dmitry Skavish <ds...@ptc.com>.
yes, i would love to receive this package. please send to dmitry@jzox.com, thanks!
by the way if I just reinitialize log4j in init of my servlet (I have only one) will
it help?

Tory Toupin wrote:

>  I've had a similar problem.  The issue is that the ClassLoader changes on you when you use the reload feature of the servlet engine.
> With the Servlet 2.3 spec, there are now lifecycle listeners that you can supposedly use to detect the change and recover.  I haven't used these, as I'm currently in Servlet 2.2 land with tomcat 3.2.3.
> I built a servlet wrapper framework that helps to take care of this.  (Again, this is something addressed by the Servlet 2.3 spec via filters.)  Basically, what I do is write an initializer servlet that acts as a pre- and post- filter on each request.  The servlet checks to see if a sentinel that it puts in the servlet context has the same class loader as itself.  If not, then it reinitializes (log4j, etc.).
> Let me know if this is something you might want to try and I'll package it up for you.
>   Dmitry Skavish <ds...@ptc.com> wrote: hello all,
> 
> I use log4j from servlets as well as jsp and just yesterday I encountered some
> very annoying problem. If I replace my servlet jar without restarting servlet engine
> (resin in this case) log4j prints the following errors and refuses to work:
> 
> log4j:WARN Failed to set property [conversionPattern] to value "%d [%p] - %m%n". object is not an instance of declaring class
> log4j:WARN Failed to set property [file] to value "/home/jzox/log/generator.log". object is not an instance of declaring class
> log4j:WARN Failed to set property [maxFileSize] to value "100KB". object is not an instance of declaring class
> log4j:WARN Failed to set property [maxBackupIndex] to value "20". object is not an instance of declaring class
> log4j:WARN File option not set for appender [R].
> log4j:WARN Are you using FileAppender instead of ConsoleAppender?
> log4j:ERROR No output stream or file set for the appender named [S].
> 
> I believe this because classloader loads new classes which don't match the old ones.
> anyway it would be nice to have some workaround or fix for it.
> thanks!
> 
> 


-- 
Dmitry Skavish
-----------------------
Boston, MA, USA
tel. +1 781 370-6909
http://www.flashgap.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: some issue with reloading

Posted by Tory Toupin <to...@yahoo.com>.
 I've had a similar problem.  The issue is that the ClassLoader changes on you when you use the reload feature of the servlet engine.
With the Servlet 2.3 spec, there are now lifecycle listeners that you can supposedly use to detect the change and recover.  I haven't used these, as I'm currently in Servlet 2.2 land with tomcat 3.2.3.
I built a servlet wrapper framework that helps to take care of this.  (Again, this is something addressed by the Servlet 2.3 spec via filters.)  Basically, what I do is write an initializer servlet that acts as a pre- and post- filter on each request.  The servlet checks to see if a sentinel that it puts in the servlet context has the same class loader as itself.  If not, then it reinitializes (log4j, etc.).
Let me know if this is something you might want to try and I'll package it up for you.
  Dmitry Skavish <ds...@ptc.com> wrote: hello all,

I use log4j from servlets as well as jsp and just yesterday I encountered some
very annoying problem. If I replace my servlet jar without restarting servlet engine
(resin in this case) log4j prints the following errors and refuses to work:

log4j:WARN Failed to set property [conversionPattern] to value "%d [%p] - %m%n". object is not an instance of declaring class
log4j:WARN Failed to set property [file] to value "/home/jzox/log/generator.log". object is not an instance of declaring class
log4j:WARN Failed to set property [maxFileSize] to value "100KB". object is not an instance of declaring class
log4j:WARN Failed to set property [maxBackupIndex] to value "20". object is not an instance of declaring class
log4j:WARN File option not set for appender [R].
log4j:WARN Are you using FileAppender instead of ConsoleAppender?
log4j:ERROR No output stream or file set for the appender named [S].

I believe this because classloader loads new classes which don't match the old ones.
anyway it would be nice to have some workaround or fix for it.
thanks!

-- 
Dmitry Skavish
-----------------------
Boston, MA, USA
tel. +1 781 370-6909
http://www.flashgap.com


--
To unsubscribe, e-mail: 
For additional commands, e-mail: 



---------------------------------
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!