M
M
MaxLich2017-10-30 10:30:06
Java
MaxLich, 2017-10-30 10:30:06

How to log a Java application?

Hello. I am studying logging, and have not yet figured out how best to do logging. In a sense, it is not clear which strategy to choose. Either at the beginning of each method, call the logger info method + call the error method in exceptions, or even use a separate object (or objects) for logging by proxy object type. Is it somehow better to organize logging in the code. Tell me who knows.
For the rest, I have no questions yet (at least for the rest there is quite a lot of information, but I have not found anything on this yet).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Cheremisin, 2017-10-30
@leahch

Log everything you need, divide into INFO/WARN/ERROR/DEBUG/TRACE/CRITICAL levels. Use a standard logger, you can tie log4j. In the application settings, you can always specify the logging level and subclasses, without recompilation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question