久久久久无码精品,四川省少妇一级毛片,老老熟妇xxxxhd,人妻无码少妇一区二区

Log4net工程使用備忘

時間:2024-07-19 23:45:17 ACCP培訓 我要投稿
  • 相關(guān)推薦

關(guān)于Log4net工程使用備忘

  為了方便廣大計算機愛好者,下面是小編整理的關(guān)于Log4net工程中的使用備忘,歡迎參考!

  (1):引用log4net

  (2):using log4net;

  (3):構(gòu)造函數(shù)中

  static CoreLogging()

  {

  log4net.Config.XmlConfigurator.Configure();

  }

  (4):private const string UnknownDeviceCategory = "UnknownDevice";

  private const string AlarmCategory = "Alarm";

  private const string GeneralCategory = "Trace";

  private const string ScriptCategory = "Script";

  private const string ConfigCategory = "Config";

  private const string ScanCategory = "Scan";

  private const string UdpCategory = "UdpSender";

  private const string MessageMergeCategory = "MessageMerge";

  private static ILog traceLog = LogManager.GetLogger(GeneralCategory);

  private static ILog scriptLog = LogManager.GetLogger(ScriptCategory);

  private static ILog configLog = LogManager.GetLogger(ConfigCategory);

  private static ILog scanLog = LogManager.GetLogger(ScanCategory);

  private static ILog messageMergeLog = LogManager.GetLogger(MessageMergeCategory);

  private static ILog udpLog = LogManager.GetLogger(UdpCategory);

  private static ILog alarmLog = LogManager.GetLogger(AlarmCategory);

  private static ILog unknownDeviceLog = LogManager.GetLogger(UnknownDeviceCategory);

  private static void Log(ILog logger, Object message, Priority priority)

  {

  switch (priority)

  {

  case Priority.DEBUG:

  logger.Debug(message);

  break;

  case Priority.INFO:

  logger.Info(message);

  break;

  case Priority.WARN:

  logger.Warn(message);

  break;

  case Priority.ERROR:

  logger.Error(message);

  break;

  case Priority.FATAL:

  logger.Fatal(message);

  break;

  }

  }

  public static void LogMessageMergeLog(object message, Priority priority)

  {

  Log(messageMergeLog, message, priority);

  }

  ///

  /// 通過Udp發(fā)送日志

  ///

  /// 要發(fā)送的消息內(nèi)容

  /// 優(yōu)先級

  public static void SendLogViaUdp(object message, Priority priority)

  {

  Log(udpLog, message, priority);

  }

  其他的略。

  配置文件中需要配置如下

  其他略

  下面為各個動作。Trace類型

【Log4net工程使用備忘】相關(guān)文章:

2016韓國冬季游學備忘09-09

工程機械使用壽命探討06-15

BEC中級寫作指導:備忘錄的寫法10-12

1歲以下寶寶衛(wèi)生護理備忘錄10-12

商務(wù)英語中的備忘錄怎么寫09-29

解析工程機械液壓柱塞泵的使用與維修09-17

鍋蓋使用技巧-如何使用鍋蓋10-29

2017年小升初每月大事備忘錄07-28

河北省建筑工程材料設(shè)備使用管理規(guī)定10-30

孩子學小提琴的七個備忘錄10-27