aspose file tools*
The moose likes Other Open Source Projects and the fly likes log4j works with stdout, nothing appears in a log file.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "log4j works with stdout, nothing appears in a log file.." Watch "log4j works with stdout, nothing appears in a log file.." New topic
Author

log4j works with stdout, nothing appears in a log file..

Ela Jarecka
Greenhorn

Joined: Mar 24, 2009
Posts: 10
Hi there,
I hope someone can point me in the right direction.. I have the following log4j.properties file ( located in the source directory of my project ):

# the root logger
log4j.rootLogger=DEBUG, stdout, catalinalog

# the stdout logger
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 %-5p [%c] %m%n
log4j.appender.stdout.Encoding=UTF-8

# the file logger
log4j.appender.catalinalog=org.apache.log4j.RollingFileAppender
log4j.appender.catalinalog.MaxFileSize=128MB
log4j.appender.catalinalog.MaxBackupIndex=10
log4j.appender.catalinalog.File=${catalina.home}/logs/SantaFe.log
log4j.appender.catalinalog.threshold=info
log4j.appender.catalinalog.layout=org.apache.log4j.PatternLayout
log4j.appender.catalinalog.layout.ConversionPattern=%d %-5p [%c] %m%n
log4j.appender.catalinalog.Encoding=UTF-8

When I run my web application using Tomcat, I can see my log entries in /webaccount/opt/tomcat/current/logs/catalina.out. The log file SantaFe.log gets created in the same directory, but
unfortunately nothing gets written in it.
What am I doing wrong? In my program, I use it in the following way:

import org.apache.log4j.Logger;

private final static Logger LOGGER = Logger.getLogger( SantaFeMain.class );

.....

Date sysdate = new Date();
LOGGER.debug( "Answer received @ " + sysdate.toString() + " in SantaFeMain:formatClaimData ( using " + ServerCommunicator.SERVICE_FORMAT_ENTRIES + " ) " );

Thanks in advance for your help!
Carol Enderlin
drifter
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364
With the threshold set to info, you won't see debug output in that file. You should get info, warn, error, fatal.

Ela Jarecka
Greenhorn

Joined: Mar 24, 2009
Posts: 10
Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: log4j works with stdout, nothing appears in a log file..
 
Similar Threads
Struts Logging
No logs from log4J on Server
Help required to log messages in tomcat :"Not able to log messages to separate files"
Log4j logs debug into info...
log4j and tomcat 6.x problem - not writing to the log files