Making an api to log and provide common methods.
public static void start(Class<?> clazz) throws IOException {
writeExecutionLog("Start of" + clazz.getName(), null);
}
public static void end(Class<?> clazz) throws IOException {
writeExecutionLog("End of" + clazz.getName(), null);
}
In classes, There are multiple schedulers in different methods which calls above start and end when job is started or finsihed.
class scheduler{
public void scheduler1(){
MyService.start(methodname or class)
MyService.end(methodname or class)
}
public void scheduler2(){
MyService.start(methodname or class)
MyService.end(methodname or class)
}
}
In place of String, is there any simple way to pass Method name with class name in above start and end method.
I want to fetch current method name dynamically in Start and end methods something like this.class.currentMethod?(not complicated statement like mentioned in geekofgeeks and better if i can handle most of things in start() and end())
Aucun commentaire:
Enregistrer un commentaire