This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes log4j: stop logging to console Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "log4j: stop logging to console" Watch "log4j: stop logging to console" New topic
Author

log4j: stop logging to console

Ruud Steeghs
Ranch Hand

Joined: Jul 09, 2001
Posts: 56
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

Joined: Nov 19, 2000
Posts: 1309
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

Joined: Jul 09, 2001
Posts: 56
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

Joined: Jul 09, 2001
Posts: 56
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 ]
 
jQuery in Action, 2nd edition
 
subject: log4j: stop logging to console
 
Similar Threads
setting up log4J for application
struts2 properties file reload
Event logging framework
Log4j logging to NT Event log
how can i print console log into in log file