File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
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!