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
« April 2024 »
April
MoTuWeThFrSaSu
1234567
891011121314
15161718192021
22232425262728
2930