• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

location of log file when using log4j

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi. i am using log4j to log in my servlet. the servlet will read a .properties file that will be used by log4j.

i specify in the .properties file my log file location as
<code>
log4j.appender.R.File=example.log
</code>
and i found the log file in <tomcat>/bin/

if i specify <code>log4j.appender.R.File=.\\logs\\example.log</log>, the log file will appear in <tomcat>/bin/logs

i wish to specify in my <tomcat>/webapps/myapp/log dir. may i know how should i do that?

Appreciate any help.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you use a relative link, the file location will be relative to the present working directory for that JVM (in your case the bin directory).
If you provide an absolute path, you can put it whereever you want.

I don't know how well it's supported but I've been able to use system properties to build the path:

In this case the logs are going to the TOMCAT/logs directory.
 
We don't have time for this. We've gotta save the moon! Or check this out:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic