/*
* Debug.java,v 1.0 2001/6/22 02:33:59
* Copyright 2000 Precom, Inc. All rights reserved.
* Copyright 2000 Precom, Inc. Tous droits reserved.
* Writer by Lee S
* Updated by Ruan Hui
* Updated by zzg
*/
package .tracer;
import org.apache.log4j.*;
/**
* This class is just a helper class to make it handy
* to print out debug statements
*/
public final class Debug
{
private static Logger logger =
Logger.getLogger("Ecc_log");
/*控制显示信息的参数*/
protected static boolean debuggingOn = true;
/*设置是否显示输出*/
public static void setDebug(boolean debug)
{
debuggingOn=debug;
}
/*获得是否显示输出*/
public static boolean getDebug()
{
return debuggingOn;
}
public static void print(String msg)
{
logger.warn(msg);
}
public static void println(String msg)
{
logger.debug(msg);
//Debug.println(this.getClass().getName()+msg);
// SystemOutThread outThread=new SystemOutThread(msg);
// outThread.start();
}
public static void printErr(String msg)
{
logger.warn(msg);
//Debug.println(this.getClass().getName()+msg);
// SystemOutThread outThread=new SystemOutThread(msg);
// outThread.start();
}
public static void print(Exception e, String msg)
{
logger.error(msg,e);
}
public static void printErr(Exception e, String errMsg)
{
logger.error(errMsg,e);
}
public static void print(Exception e)
{
logger.error("",e);
}
public static void printErr(Exception e)
{
logger.error("ERROR",e);
}
public static void print(Throwable t, String msg)
{
/*
if (debuggingOn)
{
println("Received throwable with Message: " + t.getMessage());
println(msg);
t.printStackTrace();
}
*/
logger.error(msg,t);
}
public static void printErr(Throwable t, String errMsg)
{
/*
println("Received throwable with Message: " + t.getMessage());
println(errMsg);
t.printStackTrace();
*/
logger.error(errMsg,t);
}
public static void print(Throwable t)
{
logger.error("ERROR",t);
}
public static void printErr(Throwable t)
{
logger.error("ERROR",t);
}
//信息的输出,主要用于接口的入口和出口
public static void info(Object message)
{
logger.info(message);
}
//调试语句方法
public static void debug(Object message)
{
logger.debug(message);
}
//警告语句方法
public static void warn(Object message)
{
logger.warn(message);
}
//异常
public static void error(Object message)
{
logger.error(message);
}
public static void error(Object message,Throwable t)
{
logger.error(message,t);
}
}