• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# log4net.ILog类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

 /// <summary>
 /// 初始化
 /// </summary>
 /// <param name="log"></param>
 /// <param name="properties">
 /// 可用于传递系统或环境变量等,可以作为property输出在日志内容中,layout格式如:%property{name}
 /// Tip:利用ToString()重载可以实现Active Property,但需要注意此特性对性能的消耗,建议合理配合使用IsDebugEnabled等属性
 /// http://logging.apache.org/log4net/release/manual/contexts.html
 /// 不需要则留空
 /// </param>
 /// <param name="propertiesWhenError">在Error以及Fatal级别时使用的变量集合,不需要则留空</param>
 public Log4NetLogger(log4net.ILog log
     , Func<IDictionary<string, object>> properties
     , Func<IDictionary<string, object>> propertiesWhenError)
 {
     this._log = log;
     this._properties = properties;
     this._propertiesWhenError = propertiesWhenError;
 }
开发者ID:gongzunpan,项目名称:infrastructure,代码行数:19,代码来源:Log4NetLogger.cs


示例8: StatusController

 public StatusController(Dispatcher uiDispatcher, int period, log4net.ILog visitLogger, log4net.ILog statusLogger)
 {
     this.visitLogger = visitLogger;
     this.statusLogger = statusLogger;
     _dispatcher = uiDispatcher;
     lastControllerId = -1;
     Trigger = new Timer(new TimerCallback(TimerCallback), null, 0, period);
     lastPositions = new Dictionary<int, Point3D>();
 }
开发者ID:hcilab-um,项目名称:STim,代码行数:9,代码来源:StatusController.cs


示例9: 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


示例10: BatchJob

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


示例11: 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


示例12: 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


示例13: 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


示例14: 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


示例15: 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


示例16: 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


示例17: 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


示例18: LoggingSchemaProviderAdapter

 public LoggingSchemaProviderAdapter(ISchemaProvider provider)
 {
     if (provider == null)
         throw new ArgumentNullException("provider");
     _provider = provider;
     Log = log4net.LogManager.GetLogger("Zetbox.Server.Schema." + provider.ConfigName);
 }
开发者ID:jrgcubano,项目名称:zetbox,代码行数:7,代码来源:LoggingSchemaProviderAdapter.cs


示例19: OrderReplaceProcessor

 public OrderReplaceProcessor(DriverBase myHandler, BlockingCollection<RequestData> replaceRequestsCollection)
 {
     replaceRequests = replaceRequestsCollection;
     _Handler = myHandler;
     _replaceRequest = new Dictionary<string, RequestData>();
     m_DriverLog = log4net.LogManager.GetLogger("KaiDriverLog");
 }
开发者ID:junwin,项目名称:TradingTools,代码行数:7,代码来源:OrderReplaceProcessor.cs


示例20: TextManager

        public TextManager(Map map)
        {
            _log = Logging.LogManager.GetLogger(this);
            _log.Info("TextManager is loading map text entries...");
            _texts = new List<Text>();
            _activeText = null;

            if (!map.HasLayer("text"))
            {
                _log.Info("No text layer detected on map, aborting...");
                return;
            }

            foreach (var obj in map.FindObjects((l, o) => l.Name == "text"))
            {
                string title = obj.Properties.ContainsKey("title") ? obj.Properties["title"] : "<No Title>";

                string subtitle = obj.Properties.ContainsKey("subtitle") ? obj.Properties["subtitle"] : null;

                _log.DebugFormat("Adding new text {0} of type {1}", obj.Name, obj.Type);
                _texts.Add(new Text(obj.Bounds, obj.Name, obj.Type, title, subtitle));
            }

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# logitmodel类代码示例发布时间:2022-05-24
下一篇:
C# log4net类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap