Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a Webapp running on an Amazon EC2 Linux AMI. I've been trying to configure my Log4J file for logging but haven't been able to figure out where the logs are getting created.

This is my log4j config:

log4j.rootCategory=DEBUG, FILE
log4j.rootLogger=DEBUG, FILE

# Configure a rolling file appender
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE.File=/home/ec2-user/trelta/logs/trelta.log
log4j.appender.FILE.MaxFileSize=5MB
log4j.appender.FILE.MaxBackupIndex=10
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%p %d %t %c - %m%n

#log4j.appender.FILE.org.hibernate=DEBUG
log4j.appender.FILE.org.hibernate.SQL=DEBUG
log4j.appender.FILE.org.hibernate.type=DEBUG
log4j.appender.FILE.org.hibernate.tool.hbm2ddl=warn
log4j.appender.FILE.org.hibernate.jdbc=debug

### log JDBC resource acquisition
#log4j.appender.FILE.org.hibernate.jdbc=debug

### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.appender.FILE.org.hibernate.connection.DriverManagerConnectionProvider=trace

#Logging for spring framework
log4j.appender.FILE.org.springframework=DEBUG

#Logging for jackson library
log4j.appender.FILE.org.codehaus.jackson = INFO

My user is ec2-user. Tomcat is running as a service and shows the user who started tomcat is tomcat.

So, where is my log file?

share|improve this question
    
I don't think the tomcat user would be allowed to write to /home/ec2-user/trelta/logs/ –  guido Mar 10 '13 at 8:35
    
So the will get created in the directory i mentioned if it had access? This is an absolute path right? I'm a noob at linux so don't really know.. –  Varun Achar Mar 10 '13 at 8:55
    
Try using a ConsoleAppender and see if the log messages go to <tomcat_dir>/logs/catalina.out –  guido Mar 10 '13 at 9:56

1 Answer 1

I'm on AWS EC2, Linux AMI, and relative path works fine. So if you set the file location like this:

log4j.appender.FILE.File=trelta.log

you'll find the log file in /usr/share/${yourTomcatVersion}/logs/trelta.log.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.