• ExceptionHelper异常工具类


    using System;
    using System.Collections.Generic;
    using System.Text;

    namespace JiaWel.Utilities
    {
    public static class ExceptionHelper
    {
    //日志记录
    private static readonly log4net.ILog log = log4net.LogManager.GetLogger("JiaWel.LOG4");

    /// <summary>
    /// 记录错误信息
    /// </summary>
    /// <param name="method">调用的方法名称</param>
    /// <param name="message">错误详细信息</param>
    public static void WriteException(string method, string message)
    {
    try
    {
    lock (log)
    {
    log.ErrorFormat(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " | " + method + " | 详情:" + message);
    }
    }
    catch (System.Exception)
    {
    // throw;
    }
    }

    /// <summary>
    /// 记录错误信息
    /// </summary>
    /// <param name="method">调用的方法名称</param>
    /// <param name="message">错误详细信息</param>
    public static void WriteErrorMessage(string method, string message)
    {
    try
    {
    lock (log)
    {
    log.ErrorFormat(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " | " + method + " | 详情:" + message);
    }
    }
    catch (System.Exception)
    {
    // throw;
    }
    }

    /// <summary>
    /// 记录提示信息
    /// </summary>
    /// <param name="message"></param>
    public static void WriteInfoMessage(string method, string message)
    {
    try
    {
    lock (log)
    {
    log.InfoFormat(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + " | " + method + " | 详情:" + message);
    }
    }
    catch (Exception)
    {
    // throw;
    }
    }
    }
    }

  • 相关阅读:
    多态
    重载 特点
    java 测量运行时间 单位:毫秒
    java 源代码 二分查找 Arrays
    java 同步 synchronized
    云服务器,价格其实不便宜,但为什么还要用呢
    网站访问优化(二):开启apache服务器gzip压缩
    CXF整合Spring开发WebService
    网站访问优化,未完待续
    网站访问优化,未完待续
  • 原文地址:https://www.cnblogs.com/zylbk/p/7150561.html
Copyright © 2020-2023  润新知