This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman 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 Building Microservices this week in the Design forum!
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:, FILE
log4j.appender.FILE.layout.ConversionPattern=MyApp %-5p %.25c %d{yyyyMMddHHmmss} %m%n
[ June 25, 2003: Message edited by: Ruud Steeghs ]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: log4j: stop logging to console
It's not a secret anymore!