Z
Z
Zadavatel_Voprosov2018-12-06 23:28:35
Java
Zadavatel_Voprosov, 2018-12-06 23:28:35

Java logger configuration | How to do what I need?

Hello! I make a logger and it outputs everything in a strange way...
For example:

The code
import java.util.logging.Level;
import java.util.logging.Logger;

class TestLogger {
  private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(TestLogger.class.getName());
    public static void main(String[] args) {
        log.info("Application started!\nClass: " + TestLogger.class.getName());

    }
}
Conclusion:
дек 06, 2018 11:15:21 PM TestLogger main
INFO: Application started!
Class: TestLogger

But I would like it like this:
[11:15:21] [TestLogger] INFO: Application started!
Class: TestLogger
And it's like this:
[11:15:21] [TestLogger / main] INFO: Application started!
Class: TestLogger

How can I do that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
al_gon, 2018-12-07
@al_gon

customizing default format

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question