Hi all,

Our Logger interface contains 11 traceEntry/traceExit methods and 4
deprecated entry/exit methods. As far as I have seen, only the
deprecated ones are documented in [1].

I understand the purpose of some of them:

* entry(Object...) and its vararg-free version entry() can be used to
log the parameters of a method call,
* why is there not traceEntry(Object...) non-deprecated method?
* exit(R), exit(), traceExit(R) and traceExit() log the return value
of a method call.

For those that want to be creative, you can add a custom format
specifier, so we have

* traceEntry(String, Object...) for input parameters,
* traceExit(String, R) for the return value,
* there is no traceExit(String) variant for methods returning void.

If someone wants the exit message to cite parameters again, you can
use `traceExit(EntryMessage, R)` or `traceExit(EntryMessage)`.

However these seem pretty much useless to me:

* traceEntry(Supplier...), traceEntry(String, Supplier...) seem like
overkill, since you usually log parameters that are already evaluated,
* traceEntry(Message) and traceExit(Message, R) seem also overkill to
me: if the user is not satisfied with providing a format specifier, he
can call trace(Message) or trace(Supplier) with the message of his
choice.

Should we add the missing `traceEntry(Object...)` and `traceExit()`
methods and deprecate those above?

In general I don't see users today using those methods directly in
their code. If they use them, they probably use AspectJ or a similar
framework to decorate the messages. In such a case they probably use 2
methods of the 15 above.

Piotr

[1] https://logging.apache.org/log4j/2.x/manual/messages.html

Reply via email to