Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j:ERROR Attempted to append to closed appender named [A1]

 
alex matvey
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all

I have some problem with log4j.

I have web-application which worked in glassfish 2.1 and use log4j for logging.

I'm wrote own log4j appender for sending logs to jms queue (activemq).

for configuration log4j i use ServletContextListener.

This working fine, But when I redeploy web-applications I see follows errors, and problem is solved only when I restart the application server.





Listener:



Appender code:



log4j.properties:


what could be the problem? any idea?

Thanks advance.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alex and welcome to Javaranch! Hmm ThreadDeath, that's pretty tricky! I'm not 100% sure, but you may want to look at the scope of the variables in your contextInitialised method and also think carefully about whether you need to do any work in your contextDestroyed method..
 
alex matvey
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martijn Verburg, thanks for your response.

I tried call LogManager.shutdown() into contextDestroyed method, but problem not resolved.

If I leave the method close in appender blank then the application redeployed sucessfully.

I think the problem in releasing resources ( connections... ) .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic