how to log enum (toValue) exceptions with java.util.logging?

F

Frank

I have a command line application, where I am trying to log all errors
to a file, and keep the commandline quiet.

In certain instances, I am getting some exceptions with
java.lang.Enum.valueOf (eg: java.lang.IllegalArgumentException: No enum
const class org....). The exception is being logged into my file just
fine. Problem is, it's also appearing on command line.

To control logging, I'm pretty much using a properties file based off
this example:
http://www.exampledepot.com/egs/java.util.logging/Props.html

With these changes:
# Set the default logging level for new FileHandler instances
java.util.logging.FileHandler.level = INFO
java.util.logging.ConsoleHandler.level = OFF

Any ideas on what else I can do to surpress the enum errors from the
command line?
 
D

Daniel Pitts

Frank said:
I have a command line application, where I am trying to log all errors
to a file, and keep the commandline quiet.

In certain instances, I am getting some exceptions with
java.lang.Enum.valueOf (eg: java.lang.IllegalArgumentException: No enum
const class org....). The exception is being logged into my file just
fine. Problem is, it's also appearing on command line.

To control logging, I'm pretty much using a properties file based off
this example:
http://www.exampledepot.com/egs/java.util.logging/Props.html

With these changes:
# Set the default logging level for new FileHandler instances
java.util.logging.FileHandler.level = INFO
java.util.logging.ConsoleHandler.level = OFF

Any ideas on what else I can do to surpress the enum errors from the
command line?

I suggest creating an ssccee (read about it
<http://www.physci.org/codes/sscce/>) That way we can get more
information.

I'm guessing that someone somewhere is catching that exception, calling
System.out.println, or e.printStackTrace(), and then rethrowing it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top