Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to stop the console Logging using Java.util.Logging

 
bhuvani krishna
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using java.util.Logging in my application. I want to log all the info and error messages into a log file. In this no problem for me. But in addition to logging into the file, It will also display the same log messages on the console.How to stop the console messages.Please help me out.

Thanks,
Bhuvani
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As this has nothing to do with HTML, I have moved it to a more appropriate forum.
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Logging to the console is the default behavior and is specified in a properties file in jre/lib dir.

In this java.util.logging article Jason Hunter says to create your own properties file to use instead and specify it with a system property:

java -Djava.util.logging.config.file=mylogging.properties MyClass

The LogManager Javadoc API mentions this and another option for configuring.
[ January 03, 2007: Message edited by: Carol Enderlin ]
 
bhuvani krishna
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,
I got it by using setUseParentHandlers(false)for Logger object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic