Personal tools
You are here: Home Les outils logiciels J2EE Log4j - Java 1.4 - Show Method Name on log file

Log4j - Java 1.4 - Show Method Name on log file

Nom fonction function name log logger

Use the

new Exception().getStackTrace()[0].getMethodName()

Method to write the method name on logger file

public String getIfRGRExistByLTA(String refLTA, String sens)
	log.debug(new Exception().getStackTrace()[0].getMethodName() +" : begin : " + refLTA + ", " + sens);
	.../...
	if (log.isDebugEnabled()) { 
		log.debug(new Exception().getStackTrace()[0].getMethodName() + " : end : " + ifRGRExistByLTA);
	}
	return ifRGRExistByLTA;
}

 

ll.ll..

ecrie le resultat du log

 

ll.ll..

 

 

Document Actions
« May 2024 »
May
MoTuWeThFrSaSu
12345
6789101112
13141516171819
20212223242526
2728293031