I redirected Java Logger to log in file using following code:
Handler handler = new FileHandler("test.log", LOG_SIZE, LOG_ROTATION_COUNT);
Logger.getLogger("").addHandler(handler);
but it logs in XML format. I want to be exactly like output (i.e. plain text). How can I do that?
The FileHandler can either write to a specified file, or it can write to a rotating set of files. For a rotating set of files, as each file reaches a given size limit, it is closed, rotated out, and a new file opened. Successively older files are named by adding "0", "1", "2", etc. into the base filename.
From the open Java Control Panel, Go to the "Advanced" tab. Open the Debugging section. Select "Enable tracing" and 'Enable logging"
You need to set a Formatter on your Handler. Either create your own or use the SimpleFormatter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With