• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log4j: stop logging to console

 
Ruud Steeghs
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I've configured log4j to log only error messages and info messages to a RollingFileAppender. Nice. However, all messages are also logged to the console and I would like to stop that, but don't know how.
Does anyone know how to stop logging to console?
Regards,
Ruud.
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, I apologize that I am not the person to answer your question. I am learning to use the log4j. May I know how to configure log4j to log error messages and info messages to a RollingFileAppender?
 
Ruud Steeghs
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
problem solved.
we've built an intranet application according to j2ee
architecure. log4j was being configured in an init-servlet and
that happens after ejb's are loaded (i guess...)
anyway, Loggers were initialised before log4j was
initialised properly.
solution: we're using a custom made wrapper for our
logging, in this wrapper object we initialise log4j
properly the first time a Logger is desired.
 
Ruud Steeghs
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi JiaPei Jen:
here's an example of a config file:
log4j.category.com.company.myapp=DEBUG, FILE
log4j.category.com.company.myapp.Additivity=false
log4j.appender.FILE.Threshold=ERROR
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE.File=E:/logging/MyApp/trace.log
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=MyApp %-5p %.25c %d{yyyyMMddHHmmss} %m%n
log4j.appender.FILE.MaxFileSize=5MB
log4j.appender.FILE.MaxBackupIndex=4
[ June 25, 2003: Message edited by: Ruud Steeghs ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic