how can copy and save the console message to a file using logger.
i try this :Click Here

but it's only saving warning and info messages to my file.

thank you

5 Years
Discussion Span
Last Post by subramanya.vl

I saw the code in the link provided by you.
I see that you created a custom logger of type "java.util.logging.Logger".
While defing the logger you have not set the default logging level .

Please set the default logging level in your code like this

logger.setLevel(Level.ALL);// there are more stringent  and less stringent levels than this.

You can set what ever suitable for you.

if you set "Level.ALL" then during logging the individual log messages you can log choose any of these at the time of logging.

logger.log(Level.INFO,"Test Messsage.");
logger.log(Level.WARNING,"Test Messsage.");
 logger.log(Level.SEVERE,"Test Messsage.");
logger.log(Level.INFO,"Test Messsage.");
logger.log(Level.WARNING,"Test Messsage.");
logger.log(Level.ALL,"Test Messsage.");

You can choose any logging Level you need at that time of individual log messages depending upon your need in the actual code.
This provides you the needed flexibility by setting the default logging level to Level.ALL.

Edited by subramanya.vl

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.