• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Where is logging file stored?

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 27
Tomcat Server Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
William Asher
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Grow a forest with seedballs and this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic