zoukankan      html  css  js  c++  java
  • Log4net在类库中调用写法

     public class LogHelper
        {
            public static Type type;
            public static ILog Logger
            {
                get
                {
                    ILog log = log4net.LogManager.GetLogger(type);
                    return log;
                }
            }
        }
        public class Logger
        {
            private log4net.ILog log;

            public Logger()
            {
                StackTrace st = new StackTrace(1, true);
                StackFrame[] stFrames = st.GetFrames();
                Type t = stFrames[0].GetMethod().DeclaringType;
                log = log4net.LogManager.GetLogger(t);
            }

            public void debug(string format, params object[] args)
            {
                log.DebugFormat(format, args);
            }

            public void info(string format, params object[] args)
            {
                log.InfoFormat(format, args);
            }

            public void error(string format, params object[] args)
            {
                log.ErrorFormat(format, args);
            }

            public void fatal(string format, params object[] args)
            {
                log.FatalFormat(format, args);
            }
        }

  • 相关阅读:
    (转)构建自己的AngularJS,第一部分:Scope和Digest
    使用CSS3 制作一个material-design 风格登录界面
    SS
    从零开始构建 Wijmo & Angular 2 小应用
    JavaScript使用构造函数获取变量的类型名
    Luogu-1527 [国家集训队]矩阵乘法
    Codeforces Round #525 (Div. 2)
    BZOJ-3879: SvT
    BZOJ-1396: 识别子串
    计算几何模板
  • 原文地址:https://www.cnblogs.com/zxktxj/p/2886760.html
Copyright © 2011-2022 走看看