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 API 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 API" Watch "Java Logging API" New topic

Java Logging API

Dan McKay

Joined: Aug 19, 2007
Posts: 3

Firstly, I'd just like to say that I hope I've posted this question in the right forum. (I've looked all over the web for help, so I think my question is pretty tough).

Basically, I am trying to learn about the Java Logging API. Rather than use the default config file (in jre/lib directory) to set logging levels, I want to use my own config file.

I need to start my java application without any extra arguments at the command line and have the LogManager object disregrard the default config file and read settings from my own config file instead.

Here's what I've got so far:

...and here's my properties file:

The problem is that I only get log messages displayed down to the INFO level. It seems to me as though I'm still getting the inherited settings from the root logger. This is not what I want.

Can anyone help...?

Jeff Storey
Ranch Hand

Joined: Apr 07, 2007
Posts: 230
Hi Dan,

This isn't really a direct answer to your question, but I wanted to suggest using Apache's log4j logger instead of the Java logging (I've used the Java logging a couple of times, but nothing too detailed). It's pretty much the standard for Java logging (you'll see a lot of similarities to the Java logging mostly because the Java logging is built on the same concepts of log4j).

More importantly, you'll find all sorts of help on the web for log4j since so many people use it. I hope this is of some help, but feel free to follow up with more questions.

Dan McKay

Joined: Aug 19, 2007
Posts: 3
Hi Jeff,

Thanks for your advice - I'll give the Apache logger a go and see how I get on!
I agree. Here's the link:
subject: Java Logging API
It's not a secret anymore!