jeudi 13 janvier 2022

Use log4j to print variable name java

is it possible to print a variable name using log4j?

I want to achieve something like:

SomeObject someName = 123;

log.info("The variable: " + someName.getMyName() + " was used.");

and get result: The variable: someName was used.

ps I do not have access to the object.





Aucun commentaire:

Enregistrer un commentaire