I have implemented a HttpServlet
that uses java.util.logging
for leaving Log.
Now I want that the Servlet leaves the Log inside a txt file.
I know the FileHandler
s implements this functionality.
Doubts:
Where I have to put the code that adds the
FileHanlder
to the Logger? by "where", I mean in which part of the code. I think that in theservice()
method is not correct at all.@Override protected void service(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { // HERE??? }
I want that the
FileHandler
is instanced only one time , so I have no locks problem with the txt file. How can I do that? Do you have any samples of code/recommendations?
Please forgive my bad explanation, but I am lost, and very noob in Java.