This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ela Jarecka
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic