This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes Java Logging Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Logging Question" Watch "Java Logging Question" New topic

Java Logging Question

Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536

I am pretty new to JDK-logging and I have a simple question for you all.

Below is a piece of code that appears on my application

Basically, I want to use Logging API in my application & log everything to my log file wherease log fatal errors / exceptions to the console and file.

But for some wierdo reason

logs both to my log file as well as console

What am I doing wrong?

MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

There is a default ConsoleHandler with level INFO, defined in jre/lib/

Could that be the reason for this behaviour?
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
any one?
Seb Mathe
Ranch Hand

Joined: Sep 28, 2005
Posts: 225
Sonny is right, there's a default configuration in which a ConsoleHandler is defined, with INFO Level enabled for root logger.

Try to add

at the beggining of yout code.

Or, better, define your logging configuration in a logging properties file which will override the default one.

Regards,<br />Seb<br /> <br />SCJP 1.4
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
Thanks Seb. That worked like a charm!
I agree. Here's the link:
subject: Java Logging Question
It's not a secret anymore!