Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Logging exception with java.util.logging.Logger#log() to file only

Reply
Thread Tools

Logging exception with java.util.logging.Logger#log() to file only

 
 
Royan
Guest
Posts: n/a
 
      04-01-2008
I'm logging exceptions with java.util.logging.Logger#log() (i can't
use anything apart from standard Java API) and i don't want any stack
trace to appear in stdout or stderr is there any way I can filter or
redirect all output that is produced buy this method into the file
only?
 
Reply With Quote
 
 
 
 
Andrea Francia
Guest
Posts: n/a
 
      04-01-2008
Royan wrote:
> I'm logging exceptions with java.util.logging.Logger#log() (i can't
> use anything apart from standard Java API) and i don't want any stack
> trace to appear in stdout or stderr is there any way I can filter or
> redirect all output that is produced buy this method into the file
> only?


You can use Level.FINE to log exception and Level.INFO for others message.

Then you can configure the ConsoleHandler to output only the the message
above the INFO level and the FileHandler to output ALL messages.
These configurations are done in the logging.properties configuration file.
There is a global logging.properties file located in your {JRE}/lib
directory, but you can use your own with:

java -Djava.util.logging.config.file=mylogging.propertie s

--
Andrea Francia
http://www.andreafrancia.it/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exception of type 'System.Web.HttpUnhandledException' wasthrown.Exception has been thrown by the target of an invocation.System.WebSystem.Exception jobs ASP .Net 1 11-16-2007 05:57 PM
while executing my client program i get the exception javax.naming.LinkException: [Root exception is javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException: remaining if plz anybody know how to solve this problem then mahesh Java 0 03-08-2007 12:26 PM
Re: Logging to a file and closing it again properly (logging module) Christoph Haas Python 1 06-14-2006 08:47 AM
Logging to a file and closing it again properly (logging module) Christoph Haas Python 0 06-12-2006 09:58 PM
[java.util.logging] logging only to _one_ file Stefan Siegl Java 0 08-27-2003 12:29 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57