debugwriter.jav
来自「用Java开发的、实现类似Visio功能的应用程序源码」· JAV 代码 · 共 182 行
JAV
182 行
/**
* $Id:DebugWriter.java $
*
*/
package com.jfimagine.utils.commonutil;
import org.apache.log4j.Logger;
import java.lang.Exception;
/**
* Used to wrap log4j debug tools <br>
* it requires log4jxxx.jar and log4j.properties in your classpath <br>
*
* @author Adapted from others, enhanced by CookieMaker
*
* @version $Revision: 1.00 $
*/
public class DebugWriter {
private Logger logger;
/**
* Constructor for DebugWriter
*
* @param clazz A class name for construct objects
*
*/
public DebugWriter(Class clazz) {
logger = Logger.getLogger(clazz);
}
/**
* Constructor for DebugWriter
*
* @param str A class string name for construct objects
*
*/
public DebugWriter(String str) {
logger = Logger.getLogger(str);
}
/**
* Debug method at DEBUG level of log4j
*
* @param str A string to be recorded or output
*
* @return No return
*
*/
public void debug(String str){
logger.debug(str);
}
/**
* Debug method at DEBUG level of log4j
*
* @param e An exception to be recorded or output
*
* @return No return
*
*/
public void debug(Exception e){
logger.debug(e.toString());
}
/**
* Debug method at INFO level of log4j
*
* @param e An string to be recorded or output
*
* @return No return
*
*/
public void info(String str){
logger.info(str);
}
/**
* Debug method at INFO level of log4j
*
* @param e An exception to be recorded or output
*
* @return No return
*
*/
public void info(Exception e){
logger.info(e.toString());
}
/**
* Debug method at WARN level of log4j
*
* @param str A string to be recorded or output
*
* @return No return
*
*/
public void warn(String str){
logger.warn(str);
}
/**
* Debug method at WARN level of log4j
*
* @param e An exception to be recorded or output
*
* @return No return
*
*/
public void warn(Exception e){
logger.warn(e.toString());
}
/**
* Debug method at ERROR level of log4j
*
* @param str A string to be recorded or output
*
* @return No return
*
*/
public void error(String str){
logger.error(str);
}
/**
* Debug method at ERROR level of log4j
*
* @param e An exception to be recorded or output
*
* @return No return
*
*/
public void error(Exception e){
logger.error(e.toString());
}
/**
* Debug method at FATAL level of log4j
*
* @param str A string to be recorded or output
*
* @return No return
*
*/
public void fatal(String str){
logger.fatal(str);
}
/**
* Debug method at FATAL level of log4j
*
* @param e An exception to be recorded or output
*
* @return No return
*
*/
public void fatal(Exception e){
logger.fatal(e.toString());
}
/**
* Debug method at FATAL level of log4j
*
* @param e An exception to be recorded or output
*
* @exception java.lang.Exception An exception object to be thrown
*
* @return No return
*
*/
public void throwMe(Exception e) throws Exception{
logger.fatal(e.toString());
throw e;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?