异常3

 /*
 * 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);

  }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值