This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • 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?

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


 
Sheriff
Posts: 24654
58
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).
 
Don't listen to Steve. Just read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!