• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet Destroy & log4j ?

 
hasan khan
Ranch Hand
Posts: 223
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have few servlets that use log4j, i am initializing logger in init() of servlet


i want to write the destroy() method for this servlet

i want to know what to do with to close or destory this objLogger in destroy()
 
Mat Williams
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I don't believe that you need to destroy the Logger reference (objLogger). I have never worried about it in the past and never had any trouble. I guess however if you really wanted you could simply do an objLogger = null;
Looking at the API there appears to be no means to remove/destroy one particular Logger, not in 1.2.11 anyway. You can remove all Loggers including the RootLogger but I am not sure what this will really do (see LogManager.shutdown() if you want to try it)

Mat
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!