当前位置: 首页>>代码示例>>C#>>正文


C# log4net.ILog类代码示例

本文整理汇总了C#中log4net.ILog的典型用法代码示例。如果您正苦于以下问题:C# log4net.ILog类的具体用法?C# log4net.ILog怎么用?C# log4net.ILog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


log4net.ILog类属于命名空间,在下文中一共展示了log4net.ILog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Log4NetProxy

        public Log4NetProxy(log4net.ILog logger)
        {
            if (logger == null)
                throw new ArgumentNullException("logger");

            _logger = logger;
        }
开发者ID:gavinramm,项目名称:Afterglow,代码行数:7,代码来源:Log4netProxy.cs

示例2: Log4netLogger

 public Log4netLogger(Type type)
 {
     //_innerLogger = log4net.LogManager.GetLogger(type);
     log4net.ILog[] loggers = log4net.LogManager.GetCurrentLoggers();
     _innerLogger = log4net.LogManager.GetLogger("Logging");
     log4net.Config.DOMConfigurator.Configure();
 }
开发者ID:mlinnen,项目名称:Netduino-Emulator,代码行数:7,代码来源:Log4NetLogger.cs

示例3: Log4NetLog

        public Log4NetLog(ILog4NetLog log)
        {
            if (log == null)
                throw new ArgumentNullException("log");

            this.log = log;
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:7,代码来源:Log4NetLog.cs

示例4: GoogleMapsEngineAPI

        /*
         * Constructor for Google Maps API utilities
         */
        public GoogleMapsEngineAPI(ref log4net.ILog log)
        {
            // establish the Google APIs project key
            this.GOOGLE_API_KEY = Properties.Settings.Default.gme_api_key;

            // establish the Google Maps Engine API settings
            this.GME_API_PROTOCOL = Properties.Settings.Default.gme_api_protocol;
            this.GME_API_DOMAIN = Properties.Settings.Default.gme_api_domain;
            this.GME_API_SERVICE = Properties.Settings.Default.gme_api_service;
            this.GME_API_VERSION = Properties.Settings.Default.gme_api_version;

            // set the log
            this.log = log;

            // retrieve a reference to the extension
            log.Debug("Retrieiving a reference to the extension object.");
            ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension();

            // create a Google Maps Engine Session Id for this set of sessions
            GoogleMapsEngineAPISessionId = Guid.NewGuid();

            // if debug, create a debug folder to keep track of information
            if (log.IsDebugEnabled)
            {
                // create a temporary folder
                debugDirectory = System.IO.Directory.CreateDirectory(
                    ext.getLocalWorkspaceDirectory()
                    + "\\GME_API_TMP_"
                    + GoogleMapsEngineAPISessionId.ToString().Replace("-",""));
            }
        }
开发者ID:romarknmsu,项目名称:mapsengine-arcgis-connector,代码行数:34,代码来源:GoogleMapsEngineAPI.cs

示例5: Log4NetLog

        /// <summary>
        /// Initializes a new instance of the <see cref="Log4NetLog"/> class.
        /// </summary>
        /// <param name="log">The log.</param>
        public Log4NetLog(log4net.ILog log)
        {
            if (log == null)
                throw new ArgumentNullException("log");

            m_Log = log;
        }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:11,代码来源:Log4NetLog.cs

示例6: Subtitles

 public Subtitles(log4net.ILog log = null)
 {
     Log = log;
     items = new List<SubtitleItem>();
     rwLock = new ReaderWriterLockSlim();
     SubtitleLocations = new List<string>();
     track = -1;
 }
开发者ID:iejeecee,项目名称:mediaviewer,代码行数:8,代码来源:Subtitles.cs

示例7: Main

        static void Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();
            Log = log4net.LogManager.GetLogger(typeof(Program));
            Root = ConfigurationManager.AppSettings["serviceRoot"];
            Apploader = ConfigurationManager.AppSettings["apploader"];
            Apps = new Dictionary<string, Process>();

            Log.Info("==== AppServer && Apploader ====");
            Log.InfoFormat("从目录{0}下开始启动各应用", Root);

            //TODO:支持指定pid,可通过读取对应目录下的xxxconfig来完成
            Directory.GetDirectories(Root)
                .Where(o => Filter(o)).ToList().ForEach(o => Start(o));

            //激活AppAgent
            Log.Info("启用AppAgent");
            new DefaultAgent(new Log4NetLogger(Log)
                , ConfigurationManager.AppSettings["appAgent_master"]
                , ConfigurationManager.AppSettings["appAgent_name"]
                , ConfigurationManager.AppSettings["appAgent_description"]
                , new CommandHandle())
                .Run();

            Log.Info("==== 启动完成 ====\n\n");

            RenderOutput();

            System.Console.ReadKey();
        }
开发者ID:yonglehou,项目名称:apploader,代码行数:30,代码来源:Program.cs

示例8: BatchJob

 public BatchJob()
 {
     InitializeComponent();
     log4net.Config.XmlConfigurator.Configure();
     log = log4net.LogManager.GetLogger("Log.BatchJob");
     this.ServiceName = "BatchJob";
 }
开发者ID:Novthirteen,项目名称:yfkey-scms,代码行数:7,代码来源:BatchJob.cs

示例9: WriteLog

        public void WriteLog(LogEnum name, LogLevel level, string logContent)
        {
            log = log4net.LogManager.GetLogger(name.ToString());
            //log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            switch (level)
            {
                case LogLevel.DEBUG:
                    log.Debug(logContent);
                    break;
                case LogLevel.ERROR:
                    log.Error(logContent);
                    break;
                case LogLevel.FATAL:
                    log.Fatal(logContent);
                    break;
                case LogLevel.INFO:
                    log.Info(logContent);
                    break;
                case LogLevel.WARN:
                    log.Warn(logContent);
                    break;
                default:
                    log.Debug(logContent);
                    break;
            }
        }
开发者ID:mmxftp,项目名称:JSMiracle.AutoWarehouse,代码行数:27,代码来源:Net4Log.cs

示例10: CLI

 public CLI(IDirectoryLocator directoryLocator, PluginLoader pluginLoader, IController controller)
 {
     _logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
     _directoryLocator = directoryLocator;
     _pluginLoader = pluginLoader;
     _controller = controller;
 }
开发者ID:bdhero,项目名称:bdhero-fat,代码行数:7,代码来源:CLI.cs

示例11: OnStart

      protected override void OnStart(string[] args)
      {
         string baseDir = AppDomain.CurrentDomain.BaseDirectory;
         log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(baseDir + "log4net.xml"));
         log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
         try
         {
            // Pick one
            //RemotingConfiguration.CustomErrorsEnabled(false);
            RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
            //RemotingConfiguration.Configure(baseDir + "RrdbFileService.exe.config");

            log.Info("RrdDb file server started");

            var nameValueCollection = (NameValueCollection)ConfigurationManager.GetSection("rrdbfileserver");
            log.InfoFormat("Database file base path:{0}", nameValueCollection["databasepath"]);
            string port = nameValueCollection["port"];
            int portNumber = int.Parse(port);

            channel = new TcpChannel(portNumber);
            ChannelServices.RegisterChannel(channel, false);
            log.InfoFormat("Server object registerd on port {0}", portNumber);
            RemotingConfiguration.RegisterWellKnownServiceType(
               typeof(RrdDbAdapter),
               "GetRrdDbAdapter",
               WellKnownObjectMode.Singleton);
            log.Info("Service up and running");
         }
         catch (Exception ex)
         {
            log.Error(ex);
            throw;
         }
      }
开发者ID:mujing,项目名称:rrd4net,代码行数:34,代码来源:RrdbFileService.cs

示例12: OnException

 protected override void OnException(ExceptionContext filterContext)
 {
     //Log error
     logger = log4net.LogManager.GetLogger(filterContext.Controller.ToString());
     logger.Error(filterContext.Exception.Message, filterContext.Exception);
   
 }
开发者ID:TomaszM81,项目名称:SandboxDatabaseManager,代码行数:7,代码来源:BaseController.cs

示例13: Log4NetImp

 public Log4NetImp(string log4ConfigFileFullPath,string log4ConfigLoggerName)
 {
     _log4ConfigFileFullPath = log4ConfigFileFullPath;
     _log4ConfigLoggerName = log4ConfigLoggerName;
     //Log4Net--初始化
     if (!File.Exists(_log4ConfigFileFullPath))
     {
         throw new Exception(string.Format(
             "Log4Net配置信息文件没有找到!检查配置节点{{ConfigInfo_NewMyCat:Log4NetConfigFileName}}是否正确。{0}FilePath:{1}",
             System.Environment.NewLine, _log4ConfigFileFullPath));
     }
     //
     var logCfg = new FileInfo(this._log4ConfigFileFullPath);
     XmlConfigurator.ConfigureAndWatch(logCfg);
     //
     if (string.IsNullOrWhiteSpace(log4ConfigLoggerName))
     {
         throw new Exception(string.Format("在项目配置文件中检查配置节点{{ConfigInfo_NewMyCat:Log4ConfigLoggerName}}不能为空。"));
     }
     //
     var repository = log4net.LogManager.GetRepository();
     if (repository.GetLogger(_log4ConfigLoggerName) == null)
     {
         throw new Exception(string.Format("在log4net日志配置文件({0})中检查配置节点<logger name=\"{1}\" additivity=\"false\">不存在。", log4ConfigFileFullPath,log4ConfigLoggerName));
     }           
     _logger = log4net.LogManager.GetLogger(_log4ConfigLoggerName);
 }
开发者ID:yonglehou,项目名称:Gabriel.NewMyCat,代码行数:27,代码来源:Log4netImp.cs

示例14: Main

        static void Main(string[] args)
        {
            if (string.IsNullOrEmpty(Thread.CurrentThread.Name))
                Thread.CurrentThread.Name = "Main";

            #if WINDOWS && DEBUG
            if (!System.Diagnostics.Debugger.IsAttached)
            {
                AllocConsole();
                var stdHandle = GetStdHandle(STD_OUTPUT_HANDLE);
                var safeFileHandle = new SafeFileHandle(stdHandle, true);
                var fileStream = new FileStream(safeFileHandle, FileAccess.Write);
                var encoding = Encoding.GetEncoding(CODE_PAGE);
                var stdOut = new StreamWriter(fileStream, encoding) { AutoFlush = true };
                Console.SetOut(stdOut);
            }
            #endif

            _log = LogManager.GetLogger(typeof(Program));

            _log.Info("### !!! APPLICATION LOAD !!! ###");

            _log.Info("Deleting old log files (>7 days)...");

            // Delete log files older than 7 days
            if (Directory.Exists("logs"))
            {
                var now = DateTime.Now;
                var max = new TimeSpan(7, 0, 0, 0); // 7 days
                foreach (var file in from file in Directory.GetFiles("logs")
                                        let modTime = File.GetLastAccessTime(file)
                                        let age = now.Subtract(modTime)
                                        where age > max
                                        select file)
                {
                    try
                    {
                        File.Delete(file);
                        _log.Info("Deleted old log file: " + file);
                    }
                    catch (IOException ex)
                    {
                        _log.Warn("Failed to delete log file: " + file + "(" + ex.Message + ")");
                    }
                }
            }

            _log.Info("Old log files deleted!");

            _log.Info("Starting game...");
            using (var game = new MainGame())
                game.Run();

            #if WINDOWS && DEBUG
            _log.Debug("Unloading console...");
            FreeConsole();
            _log.Debug("Console unloaded!");
            #endif
            _log.Info("### !!! APPLICATION EXIT !!! ###");
        }
开发者ID:Sharparam,项目名称:DiseasedToast,代码行数:60,代码来源:Program.cs

示例15: AudioManager

        public AudioManager(bool hardware = true)
        {
            _log = Logging.LogManager.GetLogger(this);
            _log.Info("Initializing AudioManager...");
            _log.Info("Creating FMOD system...");
            uint version = 0;

            RESULT result = Factory.System_Create(ref _system);
            ErrCheck(result);

            _log.Debug("Checking FMOD version...");
            result = _system.getVersion(ref version);
            ErrCheck(result);

            if (version < VERSION.number)
            {
                var msg = string.Format("Error! You are using an old version of FMOD: {0}. This program requires: {1}.",
                                        version.ToString("X"), VERSION.number.ToString("X"));
                _log.Fatal(msg);
                throw new FMODException(msg);
            }

            result = _system.init(MaxChannels, INITFLAGS.NORMAL, (IntPtr) null);
            ErrCheck(result);

            _soundManager = new SoundManager(_system, hardware);
            _songManager = new SongManager(_system, hardware);

            _log.Info("AudioManager initialized!");
        }
开发者ID:Sharparam,项目名称:DiseasedToast,代码行数:30,代码来源:AudioManager.cs


注:本文中的log4net.ILog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。