jQuery in Action, 3rd edition
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
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "log4j: stop logging to console" Watch "log4j: stop logging to console" New topic

log4j: stop logging to console

Ruud Steeghs
Ranch Hand

Joined: Jul 09, 2001
Posts: 56
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?
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.appender.FILE.layout.ConversionPattern=MyApp %-5p %.25c %d{yyyyMMddHHmmss} %m%n
[ June 25, 2003: Message edited by: Ruud Steeghs ]
I agree. Here's the link: http://aspose.com/file-tools
subject: log4j: stop logging to console
It's not a secret anymore!