Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在log4net中以编程方式更改日志级别?_C#_Log4net - Fatal编程技术网

C# 在log4net中以编程方式更改日志级别?

C# 在log4net中以编程方式更改日志级别?,c#,log4net,C#,Log4net,有没有办法以编程方式在log4net中设置日志级别?我以为会有一处房产让你这么做,但我似乎找不到 我想做的是有一个进入调试模式的可配置选项。这将导致额外的日志记录 我使用一个单独的log4net配置xml文件。目前,我提出的解决方案如下: 使用dom编辑日志文件,然后调用XMLConfigurator根据该文件配置日志文件 有两个日志配置文件,并在选项更改时调用xml Configurator以使用适当的日志配置文件 我倾向于使用2,这有什么原因不起作用吗?这是我以编程方式配置log4net的方

有没有办法以编程方式在log4net中设置日志级别?我以为会有一处房产让你这么做,但我似乎找不到

我想做的是有一个进入调试模式的可配置选项。这将导致额外的日志记录

我使用一个单独的log4net配置xml文件。目前,我提出的解决方案如下:

  • 使用dom编辑日志文件,然后调用XMLConfigurator根据该文件配置日志文件

  • 有两个日志配置文件,并在选项更改时调用xml Configurator以使用适当的日志配置文件


  • 我倾向于使用2,这有什么原因不起作用吗?

    这是我以编程方式配置log4net的方式:

    //declared as a class variable   
    private static readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
    
     PatternLayout layout = new PatternLayout(@"%date %-5level %message%newline");
        RollingFileAppender appender = new RollingFileAppender();
        appender.Layout = layout;
        appender.File = "c:\log.txt";
        appender.AppendToFile = true;
        appender.MaximumFileSize = "1MB";
        appender.MaxSizeRollBackups = 0; //no backup files
        appender.Threshold = Level.Error;
        appender.ActivateOptions();                       
        log4net.Config.BasicConfigurator.Configure(appender);
    
    我认为Appender的Threshold属性就是您想要的,它将控制Appender将输出的日志记录级别


    log4net有很多很好的配置示例。

    您可以通过编程更改log4net记录器的日志记录级别,但如何更改日志记录级别并不明显。我有一些代码可以做到这一点。考虑到这个记录器:

    private readonly log4net.ILog mylogger;
    
    要将其设置为调试,您必须执行以下奇特的步法:

    ((log4net.Repository.Hierarchy.Logger)mylogger.Logger).Level = log4net.Core.Level.Debug;
    

    这是你对米奇回答的后续评论

    虽然您可以通过编程设置级别,但为什么不将日志级别设置为debug呢?这样,您的用户就不必担心将日志级别设置为debug,相信我,当您需要时,它永远不会打开

    然后,当出现错误时,只需让用户向您发送完整的日志文件,并使用日志查看器之类的工具,有选择地仅查看您希望查看的级别


    另一种解决方案是将不同的级别记录到不同的文件中。通过这种方式,您可以让用户只向您发送您想要查看的级别。

    您可以从下面下载示例项目或复制粘贴代码。 代码末尾是保存日志信息的表的DDL SQL

      using System;
      using System.Collections.Generic;
      using System.Text;
      using log4net;
      using log4net.Config;
      using NUnit.Framework;
      using GenApp.Utils; 
    
      namespace ExampleConsoleApplication
      {
    
    
        class TestClass
        {
    
            private static readonly ILog logger =
                     LogManager.GetLogger ( typeof ( TestClass ) );
    
    
            static void Main ( string[] args )
            {
            TestClass objTestClass = new TestClass ();
      //log4net.Appender.ColoredConsoleAppender.Colors.HighIntensity
            GenApp.Bo.UserSettings us = new GenApp.Bo.UserSettings ();
            GenApp.Bo.User userObj = new GenApp.Bo.User ()
            {
    
              UserSettings = us
    
            };
            userObj.UserSettings.LogLevel = 4; 
    
    
    
    
            #region SetDynamicallyLogLevel
    
    
            Logger.Debug ( userObj, logger, " -- Debug msg -- " );
            Logger.Info ( userObj, logger, " -- Info msg -- " );
            Logger.Warn ( userObj, logger, " -- Warn msg -- " );
            Logger.Error ( userObj, logger, " -- Error msg -- " );
            Logger.Fatal ( userObj, logger, " -- Fatal msg -- " );
            #endregion SetDynamicallyLogLevel
    
    
    
            #region RemoveDynamicallyAppenders
            Logger.SetThreshold ( "LogFileAppender", log4net.Core.Level.Off );
    
            //and echo again
            Logger.Debug ( userObj, logger, " -- Debug msg -- " );
            Logger.Info ( userObj, logger, " -- Info msg -- " );
            Logger.Warn ( userObj, logger, " -- Warn msg -- " );
            Logger.Error ( userObj, logger, " -- Error msg -- " );
            Logger.Fatal ( userObj, logger, " -- Fatal msg -- " );
    
    
    
            #endregion RemoveDynamicallyAppenders
    
            Console.WriteLine ( " END HIT A KEY TO EXIT " );
                Console.ReadLine ();
                } //eof method 
    
    
        } //eof class 
    
      } //eof namespace 
    
    
    
    
      /* App.config CopyPaste 
      <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <configSections>
      <section name="log4net"
           type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    </configSections>
    
    <log4net>
      <appender name="LogFileAppender" type="log4net.Appender.FileAppender">
        <param name="File" value="Program.log" />
        <param name="AppendToFile" value="true" />
        <layout type="log4net.Layout.PatternLayout">
          <!--<param name="Header" value="======================================" />
          <param name="Footer" value="======================================" />-->
          <param name="ConversionPattern" value="%date{yyyy'.'MM'.'dd --- HH':'mm':'ss'.'fff} [%t] %-5p -- %m%n" />
        </layout>
      </appender>
    
      <appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
        <mapping>
          <level value="ERROR" />
          <foreColor value="Red" />
        </mapping>
        <mapping>
          <level value="DEBUG" />
          <foreColor value="HighIntensity" />
        </mapping>
        <mapping>
          <level value="INFO" />
          <foreColor value="Green" />
        </mapping>
        <mapping>
          <level value="WARN" />
          <foreColor value="Yellow" />
        </mapping>
        <mapping>
          <level value="FATAL" />
          <foreColor value="White" />
          <backColor value="Red" />
        </mapping>
    
        <layout type="log4net.Layout.PatternLayout">
          <!-- You could change here the date format -->
          <conversionPattern value="%date{yyyy'.'MM'.'dd --- HH':'mm':'ss'.'fff}  [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
        </layout>
      </appender>
    
    
      <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
        <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.2.10.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <connectionString value="data source=ysg;initial catalog=DBGA_DEV;integrated security=true;persist security info=True;" />
        <commandText value="INSERT INTO [DBGA_DEV].[ga].[tb_Data_Log] ([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread, @log_level, @logger, @message)" />
    
        <parameter>
          <parameterName value="@log_date" />
          <dbType value="DateTime" />
          <layout type="log4net.Layout.PatternLayout" value="%date{yyyy'.'MM'.'dd HH':'mm':'ss'.'fff}" />
        </parameter>
        <parameter>
          <parameterName value="@thread" />
          <dbType value="String" />
          <size value="255" />
          <layout type="log4net.Layout.PatternLayout" value="%thread" />
        </parameter>
        <parameter>
          <parameterName value="@domainName" />
          <dbType value="String" />
          <size value="255" />
          <layout type="log4net.Layout.PatternLayout" value="%user" />
        </parameter>
        <parameter>
          <parameterName value="@log_level" />
          <dbType value="String" />
          <size value="50" />
          <layout type="log4net.Layout.PatternLayout" value="%level" />
        </parameter>
        <parameter>
          <parameterName value="@logger" />
          <dbType value="String" />
          <size value="255" />
          <layout type="log4net.Layout.PatternLayout" value="%logger" />
        </parameter>
        <parameter>
          <parameterName value="@message" />
          <dbType value="String" />
          <size value="4000" />
          <layout type="log4net.Layout.PatternLayout" value="%message" />
        </parameter>
      </appender>
      <root>
        <level value="ALL" />
        <appender-ref ref="LogFileAppender" />
        <appender-ref ref="AdoNetAppender" />
        <appender-ref ref="ColoredConsoleAppender" />
      </root>
    </log4net>
    </configuration>
       */
      #region TheReferencesInThecsprojFile
      //<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
      //  <SpecificVersion>False</SpecificVersion>
      //  <HintPath>..\..\..\Log4Net\log4net-1.2.10\bin\net\2.0\release\log4net.dll</HintPath>
      //</Reference>
      //<Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL" />
      #endregion TheReferencesInThecsprojFile
    
    
    namespace GenApp.Bo
    {
      public class User
      {
    
        public int LogLevel { get; set; }
        public UserSettings UserSettings { get; set; }
    
    
      } //eof class 
    
      public class UserSettings
      {
        public int LogLevel;
      }
    
    } //eof namespace 
    
    namespace GenApp.Utils
    {
      ///<version> 1.1 </version>
      ///<author> Yordan Georgiev </author>
      ///<summary> Wrapper around log4net with dynamically adjustable verbosity</summary>
      public class Logger
      {
    
        private static Logger inst = new Logger ();
        public static Logger Inst ()
        {
          inst.ConfigureLogging ();
          return inst;
        }
    
    
        public enum DebugLevel : int
        {
          Fatal_Msgs = 0,
          Fatal_Error_Msgs = 1,
          Fatal_Error_Warn_Msgs = 2,
          Fatal_Error_Warn_Info_Msgs = 3,
          Fatal_Error_Warn_Info_Debug_Msgs = 4
        }
    
        public static void Debug ( GenApp.Bo.User userObj, ILog logger, string msg )
        {
          DebugLevel debugLevel = (DebugLevel)userObj.UserSettings.LogLevel;
          string strLogLevel = Logger.GetLogTypeString ( debugLevel );
          inst.SetLogingLevel ( strLogLevel );
          logger.Debug ( msg );
    
        } //eof method 
    
    
        public static void Info ( GenApp.Bo.User userObj, ILog logger, string msg )
        {
          DebugLevel debugLevel = (DebugLevel)userObj.UserSettings.LogLevel;
          string strLogLevel = Logger.GetLogTypeString ( debugLevel );
          inst.SetLogingLevel ( strLogLevel );
          logger.Info ( msg );
    
        } //eof method 
    
    
        public static void Warn ( GenApp.Bo.User userObj, ILog logger, string msg )
        {
          DebugLevel debugLevel = (DebugLevel)userObj.UserSettings.LogLevel;
          string strLogLevel = Logger.GetLogTypeString ( debugLevel );
          inst.SetLogingLevel ( strLogLevel );
          logger.Warn ( msg );
    
        } //eof method 
    
    
        public static void Error ( GenApp.Bo.User userObj, ILog logger, string msg )
        {
          DebugLevel debugLevel = (DebugLevel)userObj.UserSettings.LogLevel;
          string strLogLevel = Logger.GetLogTypeString ( debugLevel );
          inst.SetLogingLevel ( strLogLevel );
          logger.Error ( msg );
        } //eof method 
    
    
        public static void Fatal ( GenApp.Bo.User userObj, ILog logger, string msg )
        {
          DebugLevel debugLevel = (DebugLevel)userObj.UserSettings.LogLevel;
          string strLogLevel = Logger.GetLogTypeString ( debugLevel );
          inst.SetLogingLevel ( strLogLevel );
          logger.Fatal ( msg );
        } //eof method 
    
    
        /// <summary>
        /// Activates debug level 
        /// </summary>
        /// <sourceurl>http://geekswithblogs.net/rakker/archive/2007/08/22/114900.aspx</sourceurl>
        private void SetLogingLevel ( string strLogLevel )
        {
    
          this.ConfigureLogging ();
          string strChecker = "WARN_INFO_DEBUG_ERROR_FATAL";
    
          if (String.IsNullOrEmpty ( strLogLevel ) == true || strChecker.Contains ( strLogLevel ) == false)
            throw new ArgumentOutOfRangeException ( " The strLogLevel should be set to WARN , INFO , DEBUG ," );
    
    
    
          log4net.Repository.ILoggerRepository[] repositories = log4net.LogManager.GetAllRepositories ();
    
          //Configure all loggers to be at the debug level.
          foreach (log4net.Repository.ILoggerRepository repository in repositories)
          {
            repository.Threshold = repository.LevelMap[strLogLevel];
            log4net.Repository.Hierarchy.Hierarchy hier = (log4net.Repository.Hierarchy.Hierarchy)repository;
            log4net.Core.ILogger[] loggers = hier.GetCurrentLoggers ();
            foreach (log4net.Core.ILogger logger in loggers)
            {
              ( (log4net.Repository.Hierarchy.Logger)logger ).Level = hier.LevelMap[strLogLevel];
            }
          }
    
          //Configure the root logger.
          log4net.Repository.Hierarchy.Hierarchy h = (log4net.Repository.Hierarchy.Hierarchy)log4net.LogManager.GetRepository ();
          log4net.Repository.Hierarchy.Logger rootLogger = h.Root;
          rootLogger.Level = h.LevelMap[strLogLevel];
        }
    
        ///<summary>
        ///0 -- prints only FATAL messages 
        ///1 -- prints FATAL and ERROR messages 
        ///2 -- prints FATAL , ERROR and WARN messages 
        ///3 -- prints FATAL  , ERROR , WARN and INFO messages 
        ///4 -- prints FATAL  , ERROR , WARN , INFO and DEBUG messages 
        ///</summary>
        private static string GetLogTypeString ( DebugLevel debugLevel )
        {
    
          string srtLogLevel = String.Empty;
          switch (debugLevel)
          {
            case DebugLevel.Fatal_Msgs:
              srtLogLevel = "FATAL";
              break;
            case DebugLevel.Fatal_Error_Msgs:
              srtLogLevel = "ERROR";
              break;
            case DebugLevel.Fatal_Error_Warn_Msgs:
              srtLogLevel = "WARN";
              break;
            case DebugLevel.Fatal_Error_Warn_Info_Msgs:
              srtLogLevel = "INFO";
              break;
            case DebugLevel.Fatal_Error_Warn_Info_Debug_Msgs:
              srtLogLevel = "DEBUG";
              break;
            default:
              srtLogLevel = "FATAL";
              break;
          } //eof switch
          return srtLogLevel;
    
        } //eof GetLogTypeString
    
    
        /// <summary>
        /// The path where the configuration is read from.
        /// This value is set upon a call to ConfigureLogging().
        /// </summary>
        private string configurationFilePath;
        public void ConfigureLogging ()
        {
          lock (this)
          {
            bool configured = false;
    
    
            #region ConfigureByThePathOfTheEntryAssembly
            // Tells the logging system the correct path.
            Assembly a = Assembly.GetEntryAssembly ();
    
            if (a != null && a.Location != null)
            {
              string path = a.Location + ".config";
    
              if (File.Exists ( path ))
              {
                log4net.Config.DOMConfigurator.Configure (
                  new FileInfo ( path ) );
                configurationFilePath = path;
                configured = true;
              }
              else
              {
                path = FindConfigInPath ( Path.GetDirectoryName ( a.Location ) );
                if (File.Exists ( path ))
                {
                  log4net.Config.DOMConfigurator.Configure (
                    new FileInfo ( path ) );
                  configurationFilePath = path;
                  configured = true;
                }
              }
            }
            #endregion ConfigureByThePathOfTheEntryAssembly
    
    
            #region ConfigureByWeb.config
            //// Also, try web.config.
            //if (!configured)
            //{
            //  if (HttpContext.Current != null &&
            //    HttpContext.Current.Server != null &&
            //    HttpContext.Current.Request != null)
            //  {
            //    string path = HttpContext.Current.Server.MapPath (
            //      HttpContext.Current.Request.ApplicationPath );
    
            //    path = path.TrimEnd ( '\\' ) + "\\Web.config";
    
            //    if (File.Exists ( path ))
            //    {
            //      log4net.Config.DOMConfigurator.Configure (
            //        new FileInfo ( path ) );
            //      configurationFilePath = path;
            //      configured = true;
            //    }
            //  }
            //}
            #endregion ConfigureByWeb.config
    
    
            #region ConfigureByThePathOfTheExecutingAssembly
            if (!configured)
            {
              // Tells the logging system the correct path.
              a = Assembly.GetExecutingAssembly ();
    
              if (a != null && a.Location != null)
              {
                string path = a.Location + ".config";
    
                if (File.Exists ( path ))
                {
                  log4net.Config.DOMConfigurator.Configure (
                    new FileInfo ( path ) );
                  configurationFilePath = path;
                  configured = true;
                }
                else
                {
                  path = FindConfigInPath ( Path.GetDirectoryName ( a.Location ) );
                  if (File.Exists ( path ))
                  {
                    log4net.Config.DOMConfigurator.Configure (
                      new FileInfo ( path ) );
                    configurationFilePath = path;
                    configured = true;
                  }
                }
              }
            }
            #endregion ConfigureByThePathOfTheExecutingAssembly
    
    
            #region ConfigureByThePathOfTheCallingAssembly
            if (!configured)
            {
              // Tells the logging system the correct path.
              a = Assembly.GetCallingAssembly ();
    
              if (a != null && a.Location != null)
              {
                string path = a.Location + ".config";
    
                if (File.Exists ( path ))
                {
                  log4net.Config.DOMConfigurator.Configure (
                    new FileInfo ( path ) );
                  configurationFilePath = path;
                  configured = true;
                }
                else
                {
                  path = FindConfigInPath ( Path.GetDirectoryName ( a.Location ) );
                  if (File.Exists ( path ))
                  {
                    log4net.Config.DOMConfigurator.Configure (
                      new FileInfo ( path ) );
                    configurationFilePath = path;
                    configured = true;
                  }
                }
              }
            }
            #endregion ConfigureByThePathOfTheCallingAssembly
    
    
            #region ConfigureByThePathOfTheLibIsStored
            if (!configured)
            {
              // Look in the path where this library is stored.
              a = Assembly.GetAssembly ( typeof ( Logger ) );
    
              if (a != null && a.Location != null)
              {
                string path = FindConfigInPath ( Path.GetDirectoryName ( a.Location ) );
                if (File.Exists ( path ))
                {
                  log4net.Config.DOMConfigurator.Configure (
                    new FileInfo ( path ) );
                  configurationFilePath = path;
                  configured = true;
                }
              }
            }
            #endregion ConfigureByThePathOfTheLibIsStored
    
    
    
          } //eof lock   
        } //eof method 
    
    
    
        /// <summary>
        /// Searches for a configuration file in the given path.
        /// </summary>
        private string FindConfigInPath (
          string path )
        {
          string[] files = Directory.GetFiles ( path );
    
          if (files != null && files.Length > 0)
          {
            foreach (string file in files)
            {
              if (Path.GetExtension ( file ).Trim ( '.' ).ToLower (
                CultureInfo.CurrentCulture ) == "config")
              {
                return file;
              }
            }
          }
    
          // Not found.
          return string.Empty;
        } //eof method 
    
    
    
        /// <summary>
        /// Remove dynamically appenders
        /// </summary>
        /// <param name="appenderName"></param>
        /// <param name="threshold"></param>
        public static void SetThreshold ( string appenderName, Level threshold )
        {
          foreach (AppenderSkeleton appender in LogManager.GetRepository ().GetAppenders ())
          {
            if (appender.Name == appenderName)
            {
              appender.Threshold = threshold;
              appender.ActivateOptions ();
    
              break;
            }
          }
        } //eof method 
    
    
    
      } //eof class 
    
    
    } //eof namespace 
    
    USE [DBGA_DEV]
    GO
    
    /****** Object:  Table [ga].[tb_Data_Log]    Script Date: 05/20/2009 12:16:01 ******/
    SET ANSI_NULLS ON
    GO
    
    SET QUOTED_IDENTIFIER ON
    GO
    
    SET ANSI_PADDING ON
    GO
    
    CREATE TABLE [ga].[tb_Data_Log](
        [ID] [int] IDENTITY(1,1) NOT NULL,
        [Date] [datetime] NOT NULL,
        [Thread] [varchar](255) NOT NULL,
        [Level] [varchar](20) NOT NULL,
        [Logger] [varchar](255) NOT NULL,
        [Message] [varchar](4000) NOT NULL
    ) ON [PRIMARY]
    
    GO
    
    SET ANSI_PADDING ON
    GO
    
    使用系统;
    使用System.Collections.Generic;
    使用系统文本;
    使用log4net;
    使用log4net.Config;
    使用NUnit.Framework;
    使用GenApp.Utils;
    命名空间示例控制台应用程序
    {
    类TestClass
    {
    专用静态只读ILog记录器=
    LogManager.GetLogger(typeof(TestClass));
    静态void Main(字符串[]参数)
    {
    TestClass-objTestClass=newtestclass();
    //log4net.Appender.ColoredConsoleAppender.Colors.HighIntensity
    GenApp.Bo.UserSettings us=new GenApp.Bo.UserSettings();
    GenApp.Bo.User userObj=新建GenApp.Bo.User()
    {
    UserSettings=us
    };
    userObj.UserSettings.LogLevel=4;
    #区域集DynamicAllyLevel
    Debug(userObj,Logger,“--Debug msg-->”;
    Info(userObj,Logger,“--Info msg-->”;
    Logger.Warn(userObj,Logger,“--Warn msg-->”);
    Logger.Error(userObj,Logger,“--Error msg--”;
    Logger.Fatal(userObj,Logger,“--Fatal msg--”;
    #endregion SetDynamicallyLogLevel
    #动态移除的区域出现
    Logger.SetThreshold(“LogFileAppender”,log4net.Core.Level.Off);
    //再回音
    Debug(userObj,Logger,“--Debug msg-->”;
    Info(userObj,Logger,“--Info msg-->”;
    Logger.Warn(userObj,Logger,“--Warn msg-->”);
    Logger.Error(userObj,Logger,“--Error msg--”;
    Logger.Fatal(userObj,Logger,“--Fatal msg--”;
    #动态移除的末端区域出现
    Console.WriteLine(“结束按一个键退出”);
    Console.ReadLine();
    }//eof方法
    }//eof类
    }//eof名称空间
    /*App.config复制粘贴
    */
    #ECSProject文件中的区域引用
    //
    //假的
    //..\..\..\Log4Net\Log4Net-1.2.10\bin\net\2.0\release\Log4Net.dll
    //
    //
    #endregion TheReferencesintheECSProject文件
    名称空间GenApp.Bo
    {
    公共类用户
    {
    public int LogLevel{get;set;}
    公共用户设置用户设置{get;set;}
    }//eof类
    公共类用户设置
    {
    公共服务水平;
    }
    }//eof名称空间
    命名空间GenApp.Utils
    {
    /// 1.1 
    ///约丹·乔治耶夫
    ///log4net的包装器,详细程度可动态调整
    公共类记录器
    {
    专用静态记录器inst=新记录器();
    公共静态记录器仪器()
    {
    inst.ConfigureLogging();
    返回仪表;
    }
    公共枚举调试级别:int
    {
    致命的_Msgs=0,
    致命错误\u Msgs=1,
    致命错误警告Msgs=2,
    致命错误警告信息Msgs=3,
    致命错误警告信息调试Msgs=4
    }
    公共静态void调试(GenApp.Bo.User userObj、ILog记录器、字符串msg)
    {
    DebugLevel DebugLevel=(DebugLevel)userObj.UserSettings.LogLevel;
    string strLogLevel=Logger.GetLogTypeString(debugLevel);
    仪器设置水平(标准水平);
    logger.Debug(msg);
    }//eof方法
    公共静态无效信息(GenApp.Bo.User userObj、ILog记录器、字符串msg)
    {
    DebugLevel DebugLevel=(DebugLevel)userObj.UserSettings.LogLevel;
    string strLogLevel=Logger.GetLogTypeString(debugLevel);
    仪器设置水平(标准水平);
    logger.Info(msg);
    }//eof方法
    公共静态无效警告(GenApp.Bo.User userObj、ILog记录器、字符串消息)
    {
    调试级