Reputation: 11
This is my first java servlet so I would be glad if you can help me and tell me what to do in details :) I can see my program's logs in server console but I need to copy all logs including log.debug and log.error entries to a txt file and later send the txt file via email.
I have to define the directory/file for the logs. I have managed this for a regular java program by adding log4j.xml under src folder so I could set the directory in it, it worked, it is writing logs to a txt file created. But I do not know how to do it for the servlet version of my program. How can I set the directory for logs in the servlet and write logs to a specific txt file?
Upvotes: 1
Views: 1515
Reputation: 6820
You could use log4j
too with servlets. You just have to add your log4j.xml in the folder YOURWEBAPP/WEB-INF/classes
Upvotes: 0