This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes log4j:ERROR Attempted to append to closed appender named [A1] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "log4j:ERROR Attempted to append to closed appender named [A1]" Watch "log4j:ERROR Attempted to append to closed appender named [A1]" New topic
Author

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

alex matvey
Greenhorn

Joined: Jul 28, 2010
Posts: 2
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.

Sorry for my bad English
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

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..


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
alex matvey
Greenhorn

Joined: Jul 28, 2010
Posts: 2
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... ) .
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: log4j:ERROR Attempted to append to closed appender named [A1]
 
Similar Threads
Cannot save Dates in Toplink
connectio null problem
Error in using DBCP
Problems with struts
sometime i am getting java.lang.reflect.InvocationTargetException