Does anyone know if there is a way to get the name of the currently executing method? I'm trying to get this information so I can add it to an error log when errors occur. I imagine making a call to a static method from within the method where the error occurrs. For instance: <code> public class ClassName { public void methodName() { ErrorLogger.logError(Utilities.getMethodName()); } } So in this case I would define a static method in the Utilities class that would return the name of the current method as a String. Can this be done? Thanks.
Peter den Haan
author
Ranch Hand
Joined: Apr 20, 2000
Posts: 3252
posted
0
Don't reinvent the wheel, use Log4J. If you have to reinvent the wheel, then at least steal it - log4j can print the source file and line number of every logging call. Don't know how. Download the source and find out. - Peter
[This message has been edited by Peter den Haan (edited October 25, 2001).]