Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

No logs from log4J on Server

Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I use slf4j and log4j in Tomcat6. Locally (in my Eclipse IDE), I get the desired logs logged to the console, with my current log4j configuration. On server (Ubuntu 9.10), I assumed that ConsoleAppender logs would go to the the /var/log/tomcat6/catalina.2009-xx-xx.log files. But I don't get any application logs there. Neither do I get any warnings concerning log4j initialization at Tomcat startup.

I also configured a FileAppender, but also no logs from that in /var/log/tomcat6/ . Is something wrong with my configuration? Where should I find the file "myapp.log" created by FileAppender?


### direct log messages to stdout ###
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### direct log messages to file myapp.log ###
log4j.appender.file= org.apache.log4j.FileAppender
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### Set root logger ###
log4j.rootLogger=ERROR, stdout, file

### Set log levels for packages ###, stdout, file, stdout, file
log4j.logger.calculator=DEBUG, stdout, file

Posts: 24594
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You used a relative path in your configuration, and no doubt you made an incorrect assumption about what directory it is relative to. (Did you assume it would be relative to your web application in some way? Why would Tomcat make it relative to only one of the many web applications it could be running simultaneously?) Use an absolute path instead.
Lukas Benberg
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I assumed the Tomcat log directory to be the default directory also for its applications. It works with an absolute path (the log directory must be writable for Tomcat user).
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!