zoukankan      html  css  js  c++  java
  • c# Nlog 非xml cs方法配置

     1         public static void InitLog(TargetWithLayout target = null, string level = "Debug", string logger = "*")
     2         {
     3 
     4             LoggingConfiguration logConfig = LogManager.Configuration ?? new LoggingConfiguration();
     5 
     6             if (target == null) target = new ConsoleTarget();
     7 
     8             if (target.Name == null) target.Name = target.GetType().Name;
     9 
    10             logConfig.AddTarget(target.Name, target);
    11 
    12             logConfig.LoggingRules.Add(new LoggingRule(logger, LogLevel.FromString(level), target));
    13 
    14             LogManager.Configuration = logConfig;
    15 
    16         }

    建议 依赖 

    <package id="Anotar.NLog.Fody" version="3.3.0" targetFramework="net40" developmentDependency="true" />
    <package id="Fody" version="2.1.0" targetFramework="net40" developmentDependency="true" />
    <package id="NLog" version="4.4.11" targetFramework="net40" />
    <package id="NLog.Windows.Forms" version="4.2.3" targetFramework="net40" />

  • 相关阅读:
    Tensorflow io demo (待)
    tf.Dataset
    tf.estimator
    并发队列
    Callable的Future模式
    hadoop之HDFS介绍
    线程池
    并发工具类
    并发编程
    初学hadoop之hadoop集群搭建
  • 原文地址:https://www.cnblogs.com/yzpopulation/p/7093320.html
Copyright © 2011-2022 走看看