How to get the current class name in Java with log4j -


am using log4j logging, in order class name of of respective methods while executing, got common method uses securitymanager class name, dont want use securitymanager, other way class name during runtime. dont want write code(myclass.getclassname) classname in each , every class.

class log extends securitymanager {  public string getclassname() {         return getclasscontext()[3].getname();     }  } 

for full name (with package):

this.getclass().getname(); 

for name of class (just class name , no more):

this.getclass().getsimplename(); 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -