یادآوری

For example, we could create a message like this:

1

LOGGER.info(“Person name is “ + person.getName());

which creates unnecessary strings instances.

Using SLF4J, the correct use is :

1

LOGGER.info(“Person name is {}“, person.getName());

where format string is constant and the final message is build only if logging is enabled


https://www.javacodegeeks.com/2015/12/5-java-logging-rules.html

/ 0 نظر / 5 بازدید