This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Preventing Logging to Console

 
Alan Morgan
Ranch Hand
Posts: 113
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all,

I use the java Logging framework to log events that occur during the running of the application.

I use a FileHandler and send the messages out to multiple files.

However the log messages also appear on the console as I run.
How do I turn this off ?

Thanks,
Alan.
 
Aruneesh Salhotra
Ranch Hand
Posts: 167
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I run it through Eclipse and also observe this.
I havent looked deep into this, but I guess redirecting the output (system out) to something like /dev/null would work.
 
Abiodun Okusolubo
Ranch Hand
Posts: 72
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using Logger.getLogger("mylog").setUseParentHandlers(false);
 
Aruneesh Salhotra
Ranch Hand
Posts: 167
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This works great !!!
 
Jan Groth
Ranch Hand
Posts: 456
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you talking about logging during development or logging in your final submission?

if it is for the latter, take this into account:

i was not allowed to submit a configuration file for logging. so i favoured standard logging over hard-coded configuration, which means output of info-level and console.

passed with it, btw :-)

jan
 
Aruneesh Salhotra
Ranch Hand
Posts: 167
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question at hand was that once you initiated the application and have the logging enabled, it writes to the log file as well as displays on the console. Thats not the required behavior
 
Jan Groth
Ranch Hand
Posts: 456
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, i got that. ;-)

but my point was: if you use anything else but standard-logging - how are you configuring it? as config files and vm-arguments are not an option, you would have to write something hardcoded, or not? how are you configuring the fileapender? how does it know where to write to, in which file?

being faced with this question, i decided to favor standard-logging over any hardcoded configuration...

many greetings,
jan
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic