log4j issue

Hi Everyone,

I have to log the error and messages into a separate log file. I am trying to use che log4j.jar for this. I tried to test if log file is generated or not by invoking a Java class. The log file was created successfully. However when I run the application by invoking index.jsp, log file doesnt get created.

This is how my log4j.properties looks like:

log4j.appender.R.File=app.log

log4j.appender.R.MaxFileSize=900KB

# Don't keep a backup file

log4j.appender.R.MaxBackupIndex=0

log4j.appender.R.layout=org.apache.log4j.PatternLayout

log4j.appender.R.layout.ConversionPattern=%d{MMM dd, yyyy HH:mm:ss,SSS} %p [%t] %C{1}.%M(%L) | %m%n

# Allow debug for my app.

log4j.logger.org.apache.struts.demo=ERROR

# Control logging for other open source packages

log4j.logger.com.opensymphony.oscache=FATAL

log4j.logger.net.sf.navigator=FATAL

log4j.logger.org.apache.commons=FATAL

log4j.logger.org.apache.struts.validator=ERROR

log4j.logger.org.displaytag=FATAL

log4j.logger.org.springframework=FATAL

log4j.logger.com.ibatis.db=FATAL

log4j.logger.org.apache.commons.httpclient=ERROR

log4j.logger.httpclient=FATAL

I use OC4J as a server.

Is there something which I am lacking? Will appreciate any help a greate deal.

[1353 byte] By [tizia] at [2007-11-27 6:37:52]
# 1

It looks like your missing your root logger.

I've highlighted what i think your missing in an example of one of my log4j property files.

->log4j.rootLogger = INFO, C, F1

log4j.appender.C=org.apache.log4j.ConsoleAppender

log4j.appender.C.layout=org.apache.log4j.PatternLayout

log4j.appender.C.layout.ConversionPattern=%d %-5p %l-{%m}%n

log4j.appender.F1=org.apache.log4j.RollingFileAppender

log4j.appender.F1.File=${catalina.home}/logs/serverposter.log

log4j.appender.F1.MaxFileSize=10MB

log4j.appender.F1.MaxBackupIndex=10

log4j.appender.F1.layout=org.apache.log4j.PatternLayout

log4j.appender.F1.layout.ConversionPattern=%d %-5p %l-{%m}%n

# Print only messages of level DEBUG or above in the package com.serviceposter.

log4j.category.com.serviceposter=DEBUG

skepticala at 2007-7-12 18:06:20 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Hi ,I saw the log file getting generated finally. I have one more doubt... Can we specify the folder where we want the log file to be generated?Thanks in advance!
tizia at 2007-7-12 18:06:20 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Yes, i give you an example of that above as well.
skepticala at 2007-7-12 18:06:20 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Thanks a lot for your help! It saved me lot of time.:-)
tizia at 2007-7-12 18:06:20 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...