Annotation suggestion - logging

45 views
Skip to first unread message

Kishore MVSR

unread,
Mar 23, 2023, 8:12:39 PM3/23/23
to Project Lombok
Hello folks.
I got an idea :: annotation for log tracing.

We can use @Log (or it's friends) and Lombok generates a log field. How about an attribute (or a new annotation) to automatically print entry and exit trace logs for each method in the class ?

Example:
public void method1(){
    log.trace("Entry method1");
    .
    .
   log.trace("Exit method1");
}
public void method2(){
    log.trace("Entry method2");
    .
    .
   log.trace("Exit method2");
}

The boilerplate code in tracing for entry and exit can be handled by using Aspect Oriented Programming, but an option in Lombok would be great.!
An option can also be provided to print the time taken for each method by calculating the timestamp difference between exitand entry logs.

Thanks..!
Reply all
Reply to author
Forward
0 new messages