Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Logging API

 
Dan McKay
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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...?

THANKS!
 
Jeff Storey
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Jeff
 
Dan McKay
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeff,

Thanks for your advice - I'll give the Apache logger a go and see how I get on!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic