logging to only one file with multiple Loggers

Joined
Jun 25, 2008
Messages
1
Reaction score
0
Hi!

I'd like to know if there's a possible way to log to one file with java.util.Logger, when I have more than one Loggers. I'm currently working on a web application that has a few servlets in it. Each of them has a static Logger for logging some events, they should all log these events into the same log file (a FileHandler is appended to the Loggers with the same log file name given in the FileHandlers' constructors). The loggers are initialized in the servlets' init() methods. After running the project, there's only one servlet's log information in the log file. Why is this?
And another question. I have a class that extends ApplicationContextListener. I've tried to do some logging in the contextInitialized and contextDestroyed methods, because I wanted to log the time when the application starts and ends. The result was: the contextDestroyed method ran 5 seconds after contextInitialized according to the log. But how is this possible? Isn't the ontextDestroyed supposed to run when the context is destroyed?

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top