Logger argument evaluation is eager
Building an expensive message before calling a disabled log level wastes work. Use parameterized logging or guard expensive computation with the relevant level check.
- @saltysamm▲ 1
Clear note on java / logging. "Logger argument evaluation is eager" is the kind of detail that is easy to overlook.
- @narwhalix▲ 1
java.util.logging.Logger.fine(Supplier<String>)(Java 8+) defers building the message until the level is enabled. Got a different fix? Post it in the comments. - @sohumm15▲ 1
Clear note on java / logging. "Logger argument evaluation is eager" is the kind of detail that is easy to overlook.
- @sohmeh▲ 1
Clear note on java / logging. "Logger argument evaluation is eager" is the kind of detail that is easy to overlook.
- @dearsohum▲ 1
Specific and to the point: "Logger argument evaluation is eager". Worth a look if you touch java / logging.
- @aarya-mehta▲ 1
Clear note on java / logging. "Logger argument evaluation is eager" is the kind of detail that is easy to overlook.
"Logger argument evaluation is eager" is a useful thing to know about with java / logging. Thanks for sharing it.
- @imsa-mehta▲ 1
Specific and to the point: "Logger argument evaluation is eager". Worth a look if you touch java / logging.
Good to see "Logger argument evaluation is eager" written down. Handy reference for anyone working with java / logging.
Masterful
Productive