fileloggingexceptionhandler.java

来自「基于struts的一个异常处理框架,采用aop原理来统一处理异常。」· Java 代码 · 共 33 行

JAVA
33
字号
package org.expframework.exceptionhandler;

import org.expframework.data.ExceptionDTO;

/**
 * This class is used for logging the exceptions in a file using a logger as
 * well as getting the error code against a checked application exception.
 * 
 * @author ShriKant
 * 
 * @version 1.0
 */
public class FileLoggingExceptionHandler implements IExceptionHandler {

	/**
	 * No argument constructor
	 */
	public FileLoggingExceptionHandler() {
	}

	/**
	 * @see org.expframework.exceptionhandler.IExceptionHandler#handleException(java.lang.String,java.lang.String,
	 *      java.lang.Throwable)
	 */
	public ExceptionDTO handleException(String context, String userId,
			Throwable exp) {
		ExceptionDTO exDTO = ExceptionUtil.getExceptionDetails(context, exp);
		ExceptionUtil.logException(this.getClass(), exp, userId, exDTO
				.getLoggingType());
		return exDTO;
	}

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?