Well, I see three ways you can do this: 1. Enable location information in the pattern layout. This is slow, however, but so is using java.util.logging instead. 2. Since you're already using Log4j 2, you can use log4j-api's Logger.traceEntry() and Logger.traceExit() methods < https://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/Logger.html#traceEntry() >. 3. Emulate the tracing functionality by just using Logger.trace() with markers for entry/exit.
2017-02-13 7:57 GMT-06:00 CARTEREAU Benjamin <benjamin.carter...@cnav.fr>: > Hello, > > I would like to log method entry/exit with slf4j through an Interceptor > that knows the name of the called/intercepted method. > I have found out that XLogger makes it possible to log that kind of > activity (entry/exit of a method) but the method name cannot be specified. > And since I am in an interceptor class and not the real class/method, I > cannot rely on my logging implementation (log4j2) that could output the > method name where the logging request was issued. > Is there a way to accomplish this (like it is possible through JUL > entering/exiting methods) or could it require XLogger evolutions ? > > Regards > ************************************************************ > ***************************** > > > Ce message électronique, les éventuels fichiers joints et les informations > qu'il contient, peuvent être couverts par le secret professionnel et sont > exclusivement adressés à son destinataire. Si vous le recevez par erreur, > merci d'en informer l'expéditeur et de le détruire. A ce titre, toute > diffusion non autorisée de ce message, même partielle, sous quelque forme > que ce soit, est interdite et punie par la loi. > > En aucun cas, le contenu de ce message ne peut valoir offre ou acceptation > ou engagement de la part de la CNAV. > > Les opinions contenues dans ce message sont personnelles à l'émetteur. > > Il est de la responsabilité du destinataire de s'assurer que le message et > ses éventuelles pièces jointes ne contiennent pas de virus informatique. > _______________________________________________ > slf4j-user mailing list > slf4j-user@qos.ch > http://mailman.qos.ch/mailman/listinfo/slf4j-user -- Matt Sicker <boa...@gmail.com>
_______________________________________________ slf4j-user mailing list slf4j-user@qos.ch http://mailman.qos.ch/mailman/listinfo/slf4j-user