Skip to Content
Former Member
May 28, 2009 at 05:08 AM

how to print stacktrace in log using logging


Hi All ,

I am using logging in my webdynpro application

I hv written following java class for logging

***************************************java class Starts *******************************

public class ReferenceApplicationEJBLogger {

private static final Location LOCATION = Location.getLocation("com.apl");

private static final Category CATEGORY = Category.getCategory(Category.APPLICATIONS, "Reference Application");


LOCATION.setMinimumSeverity(CATEGORY, Severity.INFO);

LOCATION.setMaximumSeverity(CATEGORY, Severity.ALL);

CATEGORY.addLog(new FileLog("./log/application/hrhelpdesk/edmProject.%g.trc"));


public static void logException (Exception eMessage){




public static void logThrowable (Throwable eMessage){

CATEGORY.logThrowableT(Severity.WARNING, LOCATION, eMessage.getLocalizedMessage(), eMessage);


public static void logWarning (String logWarning, Exception eMessage) {

CATEGORY.warningT(LOCATION, logWarning, new Object[]{eMessage});


public static void logInfo (String logString){

CATEGORY.infoT(LOCATION, logString);


public static void logWarn (String logString){

CATEGORY.warningT(LOCATION, logString);



***********************************Java class ends here **********************************

and inside my webdynpro applicaiton i have written following code in side catch block

ReferenceApplicationEJBLogger.logInfo("Error occured in application" );

log is getting written in to defined locaiton ./log/application/hrhelpdesk/edmProject.%g.trc

but i also want to print e.printStackTrce() in above mentioned location along with message "Error occured in application".

How to go about it ? Thnx in advance