Can't get the logs in log file
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Nidhi_Tuli
Posted On:   Tuesday, October 28, 2003 05:07 PM

I am using WebLogic and I have created a log4j.properties file, and its in my WAR file in WEB-INF/classes path. log4j.properties contains: log4j.rootCategory=DEBUG, A1 log4j.appender.A1=org.apache.log4j.FileAppender log4j.appender.A1.File=/export/home/jsync.log But when I try to log the errors in my servlet, it does so only on console and does not create any new file jsync.log logger.debug("Inside SyncServlet.doPost()"); Please tell me where I am wrong? I am not intializing my logger with my log4j.prop file. Do I need to explicitly load my log4j.properties file to get my output in jsync.log file.    More>>

I am using WebLogic and I have created a log4j.properties file, and its in my WAR file in WEB-INF/classes path.


log4j.properties contains:
log4j.rootCategory=DEBUG, A1
log4j.appender.A1=org.apache.log4j.FileAppender
log4j.appender.A1.File=/export/home/jsync.log



But when I try to log the errors in my servlet, it does so only on console and does not create any new file jsync.log


logger.debug("Inside SyncServlet.doPost()");


Please tell me where I am wrong?


I am not intializing my logger with my log4j.prop file. Do I need to explicitly load my log4j.properties file to get my output in jsync.log file.

   <<Less

Re: Can't get the logs in log file

Posted By:   steve_beech  
Posted On:   Wednesday, December 10, 2003 07:41 AM

Nidhi,

Did you manage to resolve this?

I'm having a similar problem - I've been using commons logging with SimpleLog and now want to use log4j - however I only seem able to log to the console and not to the file specified in my log4j.properties file:


log4j.rootLogger=DEBUG, rolling
log4j.appender.rolling=org.apache.log4j.RollingFileAppender
log4j.appender.rolling.File=output.log

log4j.appender.rolling.MaxFileSize=100KB
log4j.appender.rolling.MaxBackupIndex=1
log4j.appender.rolling.layout=org.apache.log4j.SimpleLayout


I'm using Websphere so am not sure exactly where to put the properties files for commons and log4j.


Here is my commons-logging.properties file:


org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JCategoryLog


Any thoughts?

Re: Can't get the logs in log file

Posted By:   ravi_sambandam  
Posted On:   Thursday, December 4, 2003 03:28 AM

As Prasanna Talakanti said either file path can be a problem or u would have overridden the fileappender definition any where below with console appender.

Try this to configure the log4j in the class of ur application that is called first

PropertyConfigurator.configure(LogFilename);
and then try to log the data.

Re: Can't get the logs in log file

Posted By:   Prasanna_Talakanti  
Posted On:   Friday, November 7, 2003 11:31 AM

I suspect that, You have console appender after your file appender


log4j.rootCategory=DEBUG, A1
log4j.appender.A1=org.apache.log4j.FileAppender
//file path can cause problems some time
log4j.appender.A1.File=/export/home/jsync.log

//if you have this, the file appender would not log any thing
log4j.appender.A1=org.apache.log4j.ConsoleAppender


hope this helps
About | Sitemap | Contact