Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

No logs from log4J on Server

 
Lukas Benberg
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?

Thanks


### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
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.File=myapp.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
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 ###
log4j.logger.data=DEBUG, stdout, file
log4j.logger.data.feeds=DEBUG, stdout, file
log4j.logger.calculator=DEBUG, stdout, file

 
Paul Clapham
Sheriff
Posts: 21107
32
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
Thanks,
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic