File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Where is logging file stored? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Where is logging file stored?" Watch "Where is logging file stored?" New topic
Author

Where is logging file stored?

William Asher
Greenhorn

Joined: Jul 23, 2009
Posts: 25
I know there are no stupid questions, but this one feels stupid. I am trying to use the commons-logging API in a servlet, and can't figure out where the log is written.

Here is part of my code


Although I don't think this was really necessary, I created a commons-logging.properties file with a single keyword in it:


And I created a log4j.properties with a single keyword in it:


I have tried varying the "/" characters to "\" since I am running Tomcat 6.0 on my Windows XP system. I have looked for the log in d:\temp\mylog.log, and also in the C:\Program Files\Apache Software Foundation\Tomcat 6.0\logs folder. I can't find the log!

My program compiles with no problem and the servlet runs and displays results (it updates and displays data from a MySQL database; the code for that part is not shown above).

Any ideas as to where that pesky log is (or what it is called by default, in the absence of my attempt at overriding the default) would be appreciated.
parampreet sethi
Greenhorn

Joined: Aug 03, 2009
Posts: 27

Where have you copied the log4j.properties file? Normally it's available inside webapps/App/WEB-INF/classes folder.

The another thing you can try is removing the full path from



and keep it as



This should by default create the log file inside the Tomcat logs folder.


Param
William Asher
Greenhorn

Joined: Jul 23, 2009
Posts: 25
Parampreet:
Thanks for your suggestion, but unfortunately I haven't had success finding the log file yet.

I had the two properties files (log4j.properties and commons-logging.properties) in the WEB-INF folder. I moved them as you suggested to a newly created classes folder under WEB-INF but got the same result - successful servlet execution with no exceptions, but I cannot find the log data anywhere.

I also tried removing the absolute path from the property value in log4j.properties, and got the same result.

Initially I tried all this without using any property files, under the assumption that the system would place the log in a default location (the Tomcat logs folder). Tomcat creates four logs in that folder (host-manager.yyyy-mm-dd.log, manager.yyyy-mm-dd.log, localhost.yyyy-mm-dd.log, and catalina.yyyy-mm-dd.log), but none of these logs contain my output. Is there a default location (and physical file name) where the log gets written?

Of course I scoured the commons-logging documentation before I posted, but I could not find any reference to a physical file where the logging data would be stored. Which is why I posted the question. Certainly somebody has used this logging facility and has then actually opened the log in a text editor to see what it contains.

Thanks in advance for any further help!

William Asher
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Where is logging file stored?