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


C# ILog.Info方法代码示例

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


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

示例1: Application_Start

        protected void Application_Start()
        {
            AppDomain.CurrentDomain.UnhandledException += Application_Error;
            try
            {
                XmlConfigurator.Configure();
                AppLogger = LogManager.GetLogger(GetType());
                AppLogger.Info("Application_Start...");

                AppLogger.Info("Bootstrapping the container...");
                Container = ContainerConfig.Config(AppLogger);

                AppLogger.Info("Setting the Controller Factory...");
                var controllerFactory = new WindsorControllerFactory(Container.Kernel);
                ControllerBuilder.Current.SetControllerFactory(controllerFactory);

                AreaRegistration.RegisterAllAreas();

                WebApiConfig.Register(GlobalConfiguration.Configuration);
                FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
                RouteConfig.RegisterRoutes(RouteTable.Routes);
                BundleConfig.RegisterBundles(BundleTable.Bundles);
                AuthConfig.RegisterAuth();
            }
            catch (Exception ex)
            {
                AppLogger.Fatal("Application_Start FAILED", ex);
                throw;
            }
        }
开发者ID:robgray,项目名称:NHibernateFacilityMVC4Test,代码行数:30,代码来源:Global.asax.cs

示例2: ControllerService

        public ControllerService()
        {
            logger = LogManager.GetLogger("ControllerService");
            logger.Info("ControllerService initializing...");

            // Read port value
            int port;
            if (ConfigurationManager.AppSettings["ControllerPort"] != null)
            {
                if (!int.TryParse(ConfigurationManager.AppSettings["ControllerPort"], out port))
                {
                    port = DefaultPort;
                }
            }
            else
            {
                port = DefaultPort;
            }

            // Create server
            this.server = new ControllerServer(port, logger);
            this.server.OnClientConnected += this.ServerOnClientConnected;

            logger.Info("ControllerService initialized.");
        }
开发者ID:romanpeshterski,项目名称:OpenJudgeSystem,代码行数:25,代码来源:ControllerService.cs

示例3: QueueProcessor

        public QueueProcessor(string QueuePath)
        {
            //访问本地电脑上的消息队列时Path的格式可以有如下几种:
            //MessageQueue mq = new MessageQueue();
            //mq.Path = @".\Private$\test";
            //mq.Path = @"sf00902395d34\Private$\test";  //sf00902395d34是主机名
            //mq.Path = @"FormatName:DIRECT=OS:sf00902395d34\Private$\test";
            //mq.Path = @"FormatName:DIRECT=OS:localhost\Private$\test";

            //访问远程电脑上的消息队列时Path的格式
            //mq.Path = @"FormatName:DIRECT=OS:server\Private$\test";            

            reset = new ManualResetEvent(true);
            logger = LogManager.GetLogger("logger");

            _path = QueuePath;

            //判断指定的消息队列是否存在
            if (MessageQueue.Exists(QueuePath))
            {
                queue = new MessageQueue(QueuePath);
                logger.Info(string.Format("Init : {0} successfully!", QueuePath));
            }
            else
            {
                //不存在,创建
                queue = MessageQueue.Create(QueuePath);                
                //赋予权限
                queue.SetPermissions("Everyone", MessageQueueAccessRights.FullControl, AccessControlEntryType.Set);

                logger.Info(string.Format("Create message queue : {0} successfully!", QueuePath));
            }
        }
开发者ID:danielmartind,项目名称:MSMQ_EMIAL,代码行数:33,代码来源:QueueProcessor.cs

示例4: Main

        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            //if (log4net.LogManager.GetCurrentLoggers().Length == 0)
            {
                log4net.Config.XmlConfigurator.Configure(new FileInfo("log4net.config"));
            }
            logger = log4net.LogManager.GetLogger(typeof(Program));

            logger.Info("LogzAppender working!!");
            logger.Info("This is another message!!");

            try
            {
                var a = 0;
                a += 0;
                var b = 5 / a;
            }
            catch (Exception ex)
            {
                logger.Error(new Dictionary<String, String>() {
                             	 { "message", "test message" },
                             	 { "gilly", "barr" }
                             }, ex);
            }

            Console.ReadKey(true);
        }
开发者ID:csadevio,项目名称:dotnet-LogzAppender,代码行数:29,代码来源:Program.cs

示例5: Init

        public void Init(string[] args)
        {
            ParseArgs(args);
            mLogger = LogManager.GetLogger(GetType().Name);
            mLogger.Info(string.Format("Initializing Emulator Manager processor with args: [{0}]",string.Join(",",args)));

            if (configPath == null)
            {
                ConfigComponent.Instance.Initialize();
            }
            else
            {
                ConfigComponent.Instance.Initialize(configPath);
            }

            if (serverUrl == null)
            {
                RomDataComponent.Instance.Initialize();
            }
            else
            {
                RomDataComponent.Instance.Initialize(serverUrl);
            }

            mLogger.Info("Done Initializing Emulator Manager processor");
        }
开发者ID:redsoxfantom,项目名称:emulator-manager,代码行数:26,代码来源:Processor.cs

示例6: OrgDataGenerator

 public OrgDataGenerator(ProvisionerConfig config,IDocumentStore orgStore,IDocumentStore masterStore,ILog logger,bool newOrg=true )
 {
     _logger = logger;
     var orgUrl = "unknown";
     var masterUrl = "unknown";
     if (orgStore.Url != null)
         orgUrl = orgStore.Url;
     if (masterStore.Url != null)
         masterUrl = masterStore.Url;
     _logger.Info(string.Format("Data generator - OrgDataGenerator for org store {0}, master store {1}, new org is {2}", orgUrl, masterUrl, newOrg));
     _logger = logger;
     _config = config;
     _orgStore = orgStore;
     _masterStore = masterStore;
     if(newOrg)
         GenerateLookupData();
     if(_config.Users!=null)
         StoreInOrg(_config.Users);
     if (_config.AuthUsers != null)
     {
         _logger.Info(string.Format("Data generator - about to generate {0} auth users",_config.AuthUsers.Count()));
         StoreInMaster(_config.AuthUsers);
         foreach (var authUser in _config.AuthUsers)
         {
             var matchingUser = _config.Users.First(u => u.Id == authUser.Id);
             var password = MembershipRebootHelper.GenerateRandomPassword();
             MembershipRebootHelper.CreateLocalAccount(IlluminateDatabase.GetMasterFromConfig(), matchingUser.EmailAddress, password);
             Email.EmailActivation(matchingUser, authUser, _orgStore,password);
         }
         _logger.Info(string.Format("Data generator - generated {0} auth users", _config.AuthUsers.Count()));
     }
         
 }
开发者ID:andyevans2000,项目名称:Illuminate,代码行数:33,代码来源:OrgDataGenerator.cs

示例7: WaitForResultOfRequest

        protected void WaitForResultOfRequest(ILog logger, string workerTypeName, IOperation operation, Guid subscriptionId, string certificateThumbprint, string requestId)
        {
            OperationResult operationResult = new OperationResult();
            operationResult.Status = OperationStatus.InProgress;
            bool done = false;
            while (!done)
            {
                operationResult = operation.StatusCheck(subscriptionId, certificateThumbprint, requestId);
                if (operationResult.Status == OperationStatus.InProgress)
                {
                    string logMessage = string.Format(CultureInfo.CurrentCulture, "{0} '{1}' submitted a deployment request with ID '{2}', the operation was found to be in process, waiting for '{3}' seconds.", workerTypeName, this.Id, requestId, FiveSecondsInMilliseconds / 1000);
                    logger.Info(logMessage);
                    Thread.Sleep(FiveSecondsInMilliseconds);
                }
                else
                {
                    done = true;
                }
            }

            if (operationResult.Status == OperationStatus.Failed)
            {
                string logMessage = string.Format(CultureInfo.CurrentCulture, "{0} '{1}' submitted a deployment request with ID '{2}' and it failed. The code was '{3}' and message '{4}'.", workerTypeName, this.Id, requestId, operationResult.Code, operationResult.Message);
                logger.Error(logMessage);
            }
            else if (operationResult.Status == OperationStatus.Succeeded)
            {
                string logMessage = string.Format(CultureInfo.CurrentCulture, "{0} '{1}' submitted a deployment request with ID '{2}' and it succeeded. The code was '{3}' and message '{4}'.", workerTypeName, this.Id, requestId, operationResult.Code, operationResult.Message);
                logger.Info(logMessage);
            }
        }
开发者ID:StealFocus,项目名称:Forecast,代码行数:31,代码来源:HostedServiceForecastWorker.cs

示例8: ParseWeichatXML

        public static WeiChatReceivedContentMessage ParseWeichatXML(string xml,ILog logger=null)
        {
            WeiChatReceivedContentMessage message = new WeiChatReceivedContentMessage();
            try
            {
                logger.Info("ParseWeichatXML");
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(xml);
                XmlNode contentNode = xmlDoc.SelectSingleNode("/xml/Content");
                if(contentNode!=null && !string.IsNullOrEmpty(contentNode.InnerText))
                {
                    message.Content = contentNode.InnerText.Trim();
                }
                XmlNode toUserNode = xmlDoc.SelectSingleNode("/xml/ToUserName");
                if (toUserNode != null && !string.IsNullOrEmpty(toUserNode.InnerText))
                {
                    message.ToUserName = toUserNode.InnerText.Trim();
                }

                XmlNode msgType = xmlDoc.SelectSingleNode("/xml/MsgType");
                if (msgType != null && !string.IsNullOrEmpty(msgType.InnerText))
                {
                    message.MsgType = msgType.InnerText.Trim();
                }

                XmlNode fromUserNode = xmlDoc.SelectSingleNode("/xml/FromUserName");
                if (fromUserNode != null && !string.IsNullOrEmpty(fromUserNode.InnerText))
                {
                    message.FromUserName = fromUserNode.InnerText.Trim();
                }
                XmlNode msgIdNode = xmlDoc.SelectSingleNode("/xml/MsgId");
                if (msgIdNode != null && !string.IsNullOrEmpty(msgIdNode.InnerText))
                {
                    message.MsgId = msgIdNode.InnerText.Trim();
                }
                XmlNode createTimeNode = xmlDoc.SelectSingleNode("/xml/CreateTime");
                if (createTimeNode != null && !string.IsNullOrEmpty(createTimeNode.InnerText))
                {
                    long time = 0;
                    long.TryParse( createTimeNode.InnerText, out time);
                    message.CreateTime = time;
                }
                xmlDoc = null;
            }
            catch(Exception ex)
            {
                if(logger!=null)
                {
                    logger.Error(ex);
                }
            }finally
            {
                logger.Info("Finished ParseWeichatXML");
            }
            return message;
        }
开发者ID:Bobom,项目名称:kuanmai,代码行数:56,代码来源:WeiChatMessageUtil.cs

示例9: ReadDecisionFile

        /// <summary>
        /// Reads and processes any decision files in the configured folder
        /// </summary>
        /// <param name="fileReaderStrategy"></param>
        /// <param name="log"></param>
        public static void ReadDecisionFile(DecisionManager.DecisionFileReader fileReaderStrategy, ILog log)
        {
            if (fileReaderStrategy == null) throw new ArgumentNullException("fileReaderStrategy");
            if (log == null) throw new ArgumentNullException("log");

            try
            {
                // Get folder and file pattern from web.config so they're easy to update
                string folder = ConfigurationManager.AppSettings["DecisionsFolder"];
                if (String.IsNullOrEmpty(folder)) throw new ConfigurationErrorsException("DecisionsFolder setting is missing from appSettings in app.config");

                string filePattern = ConfigurationManager.AppSettings["DecisionFiles"];
                if (String.IsNullOrEmpty(filePattern)) throw new ConfigurationErrorsException("DecisionFiles setting is missing from appSettings in app.config");

                // Look in the folder, deal with and then delete each file
                var filenames = Directory.GetFiles(folder, filePattern, SearchOption.TopDirectoryOnly);
                foreach (string filename in filenames)
                {
                    // Log that we're working on this file
                    Console.WriteLine(String.Format(CultureInfo.CurrentCulture, Properties.Resources.LogReadingFile, filename));
                    log.Info(String.Format(CultureInfo.CurrentCulture, Properties.Resources.LogReadingFile, filename));

                    if (File.Exists(filename))
                    {
                        fileReaderStrategy(filename, log);

                        var delete = String.IsNullOrEmpty(ConfigurationManager.AppSettings["DeleteProcessedFiles"]);
                        try
                        {
                            if (!delete) delete = Boolean.Parse(ConfigurationManager.AppSettings["DeleteProcessedFiles"]);
                        }
                        catch (FormatException ex)
                        {
                            throw new ConfigurationErrorsException("DeleteProcessedFiles setting in app.config appSettings must be a boolean", ex);
                        }

                        if (delete)
                        {
                            Console.WriteLine(String.Format(CultureInfo.CurrentCulture, Properties.Resources.LogDeletingFile, filename));
                            log.Info(String.Format(CultureInfo.CurrentCulture, Properties.Resources.LogDeletingFile, filename));

                            File.Delete(filename);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                log.Error(ex.Message, ex);

                ex.ToExceptionless().Submit();

                return;
            }
        }
开发者ID:east-sussex-county-council,项目名称:Escc.Gritting,代码行数:61,代码来源:DecisionManager.cs

示例10: AgentService

        public AgentService()
        {
            logger = LogManager.GetLogger("AgentService");
            logger.Info("AgentService initializing...");

            // TODO: Extract class ConfigurationManager
            // Read controller address
            if (ConfigurationManager.AppSettings["ControllerAddress"] == null)
            {
                logger.Fatal("ControllerAddress setting not found in App.config file!");
                throw new Exception("ControllerAddress setting not found in App.config file!");
            }

            var controllerAddress = ConfigurationManager.AppSettings["ControllerAddress"];

            // Read controller port
            if (ConfigurationManager.AppSettings["ControllerPort"] == null)
            {
                logger.Fatal("ControllerPort setting not found in App.config file!");
                throw new Exception("ControllerPort setting not found in App.config file!");
            }

            int controllerPort;
            if (!int.TryParse(ConfigurationManager.AppSettings["ControllerPort"], out controllerPort))
            {
                logger.Fatal("ControllerPort setting is not an integer!");
                throw new Exception("ControllerPort setting is not an integer!");
            }

            // Read threads count value
            int threadsCount;
            if (ConfigurationManager.AppSettings["ThreadsCount"] != null)
            {
                if (!int.TryParse(ConfigurationManager.AppSettings["ThreadsCount"], out threadsCount))
                {
                    threadsCount = DefaultThreadsCount;
                }
            }
            else
            {
                threadsCount = DefaultThreadsCount;
            }

            // Create clients
            this.clients = new List<AgentClient>();
            for (var i = 1; i <= threadsCount; i++)
            {
                var client = new AgentClient(controllerAddress, controllerPort, logger);
                this.clients.Add(client);
            }

            logger.Info("AgentService initialized.");
        }
开发者ID:Dimitvp,项目名称:OpenJudgeSystem,代码行数:53,代码来源:AgentService.cs

示例11: LoggerFacade

 /// <summary>
 /// Initializes a new instance of the LoggerFacade class that implements the log4net logger.
 /// </summary>
 public LoggerFacade()
 {
     // Log4net requires a call to configure the logger from
     // the App.config file prior to calling GetLogger().
     log4net.Config.XmlConfigurator.Configure();
     logger = LogManager.GetLogger(typeof(LoggerFacade));
     logger.Info("*********************************************");
     logger.Info("*********************************************");
     logger.Info("AuthorisationManager.WCFServiceHost");
     logger.Info("Copyright © Development In Progress Ltd 2016");
     logger.Info("Start Service");
 }
开发者ID:grantcolley,项目名称:authorisationmanager,代码行数:15,代码来源:LoggerFacade.cs

示例12: Test2

        internal static void Test2(ILog logger)
        {
            logger.Info("first message " + DateTime.Now.ToString());
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            for (int x = 0; x < 1000000; x++)
            {
                logger.Info("Logging message: " + x);
            }

            stopwatch.Stop();
            Console.WriteLine("Last message: " + DateTime.Now);
            Console.WriteLine("time taken: " + stopwatch.ElapsedMilliseconds);
        }
开发者ID:georgesimms,项目名称:logit-dotnet,代码行数:14,代码来源:Program.cs

示例13: Application_Start

        protected void Application_Start()
        {
            log4net.Config.XmlConfigurator.Configure();
            log = LogManager.GetLogger("nhibernatedemo");
            log.Info("Starting up");

            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);

            CreateContainer();
            log.Info("Startup complete");
        }
开发者ID:stimms,项目名称:NHibernate-Demo,代码行数:14,代码来源:Global.asax.cs

示例14: Init

        public static void Init()
        {
            _log = LogManager.GetLogger("AppDomain");

            var _fa =
                new FileAppender()
                {
                    Layout = new log4net.Layout.PatternLayout("%timestamp [%thread] %-5level %logger - %message%newline"),
                    File = Path.Combine(Environment.CurrentDirectory, "update.log"),
                    AppendToFile = false
                };
            _fa.ActivateOptions();
            BasicConfigurator.Configure(
                _fa,
                new ConsoleAppender()
            );

            AppDomain.CurrentDomain.AssemblyLoad += (sender, e) =>
            {
                _log.DebugFormat("Assembly load: {0}", e.LoadedAssembly.FullName);
            };
            AppDomain.CurrentDomain.ProcessExit += (sender, e) =>
            {
                _log.Info("Process exiting.");
            };
            AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
            {
                _log.ErrorFormat("Unhandled exception: {0}", e.ExceptionObject.ToString());
            };
        }
开发者ID:icedream,项目名称:modernminas-launcher,代码行数:30,代码来源:Log.cs

示例15: Info

 /// <summary>
 /// The info.
 /// </summary>
 /// <param name="log">
 /// The log.
 /// </param>
 /// <param name="message">
 /// The message.
 /// </param>
 public static void Info(ILog log, string message)
 {
     if (log != null && log.IsInfoEnabled)
     {
         log.Info(message);
     }
 }
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:16,代码来源:LoggingUtil.cs


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