Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic