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


C# ILog.InfoFormat方法代码示例

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


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

示例1: ElasticCasFactory

        public ElasticCasFactory(string name)
        {
            // Init Log
            Logger = LogManager.GetLogger(name);

            if (Settings.Exists()) {
                Logger.InfoFormat("Using ElasticSearch Host : {0}", Settings.ElasticSearchServer);
            } else {
                Logger.InfoFormat("No ElasticSearch Host specified, using default : {0}", Settings.ElasticSearchServer);
            }

            client = new ElasticClientWrapper();
            Logger.InfoFormat("New ElasticSearch Connection from {0}", name);
        }
开发者ID:Terradue,项目名称:DotNetElasticCas,代码行数:14,代码来源:ElasticCasFactory.cs

示例2: ViewBuilder

        public ViewBuilder()
        {
            _logger = log4net.LogManager.GetLogger(this.GetType());

            Type genericMessageHandlerType = typeof (IHandleMessages<>);
            var eventStore = new PersistenceWireup(
                Wireup.Init()
                    .UsingRavenPersistence("MembershipEventStore")
                )
                .InitializeStorageEngine()
                .Build();

            var container = BootstrapMessageHandlers();

            var commits = eventStore.Advanced.GetFrom(new DateTime(1900, 1, 1));
            foreach (var commit in commits)
            {
                foreach (var @event in commit.Events.Select(x => x.Body))
                {
                    Type eventType = @event.GetType();
                    _logger.InfoFormat("Handling event '{0}'", @eventType.Name);
                    Type specificEventHandlerType = genericMessageHandlerType.MakeGenericType(eventType);
                    Type enumerableOfEventHandlerType = typeof (IEnumerable<>).MakeGenericType(specificEventHandlerType);
                    var handlers = container.Resolve(enumerableOfEventHandlerType) as IEnumerable;
                    bool hadHandlers = false;
                    if (handlers != null)
                    {
                        foreach (var handler in handlers)
                        {
                            hadHandlers = true;
                            _logger.InfoFormat("  Processing event with handler {0}", handler.GetType());
                            var genericHandleMethod =
                                handler.GetType().GetMethods().Where(
                                    m => m.Name == "Handle" && m.GetParameters()[0].ParameterType == eventType).
                                    SingleOrDefault();
                            if (genericHandleMethod != null)
                            {
                                genericHandleMethod.Invoke(handler, new object[]{ @event });
                            }
                        }
                    }
                    if (!hadHandlers)
                    {
                        _logger.InfoFormat("No handlers found for event type {0}", eventType.Name);
                    }
                }
            }
        }
开发者ID:thatpaulschofield,项目名称:LifeMap,代码行数:48,代码来源:Program.cs

示例3: GetProviderFromConfigName

        public static IGroupDataProvider GetProviderFromConfigName(ILog log, IConfig groupsConfig, string configName)
        {
            switch (configName)
            {
                case "XmlRpc":
                    string ServiceURL = groupsConfig.GetString("XmlRpcServiceURL");
                    bool DisableKeepAlive = groupsConfig.GetBoolean("XmlRpcDisableKeepAlive", false);

                    string ServiceReadKey = groupsConfig.GetString("XmlRpcServiceReadKey", String.Empty);
                    string ServiceWriteKey = groupsConfig.GetString("XmlRpcServiceWriteKey", String.Empty);

                    log.InfoFormat("[GROUPS]: XmlRpc Service URL set to: {0}", ServiceURL);

                    return new XmlRpcGroupDataProvider(ServiceURL, DisableKeepAlive, ServiceReadKey, ServiceWriteKey);


                case "Native":
                    string dbType = groupsConfig.GetString("NativeProviderDBType");
                    string connStr = groupsConfig.GetString("NativeProviderConnString");

                    ConnectionFactory connFactory = new ConnectionFactory(dbType, connStr);
                    return new NativeGroupDataProvider(connFactory);

            }

            return null;
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:27,代码来源:ProviderFactory.cs

示例4: PrintVersion

 static void PrintVersion(ILog log)
 {
     var assembly = Assembly.GetExecutingAssembly();
     var attr = assembly.GetCustomAttribute<AssemblyVersionAttribute>();
     var version = attr == null ? "FIXME" : attr.Version;
     log.InfoFormat("nsq_rand {0}", version);
 }
开发者ID:xzoth,项目名称:NSQnet,代码行数:7,代码来源:Program.cs

示例5: RunProcess

        protected void RunProcess(string executablePath, string executableArgs, ILog logger)
        {
            logger.InfoFormat("{0} {1}", executablePath, executableArgs);
            var msDeploy = new Process
                               {
                                   StartInfo =
                                       {
                                           UseShellExecute = false,
                                           RedirectStandardError = true,
                                           RedirectStandardOutput = true,
                                           FileName = executablePath,
                                           Arguments = executableArgs
                                       }
                               };
            msDeploy.Start();

            while (!msDeploy.HasExited)
            {
                var output = msDeploy.StandardOutput.ReadToEnd();
                var error = msDeploy.StandardError.ReadToEnd();

                logger.Info(output);
                if (error.Length > 0)
                {
                    logger.Error(error);
                    throw new ApplicationException("An error occurred running process '"+Path.GetFileName(executablePath)+"'",
                        new Exception(error));
                }

                msDeploy.WaitForExit(2000);
            }
        }
开发者ID:repne,项目名称:DeployD,代码行数:32,代码来源:DeploymentHookBase.cs

示例6: LogScope

 public LogScope(ILog log, string format, params object[] args)
 {
     this.log = log;
     message = String.Format(format, args);
     log.InfoFormat("Begin: {0}", message);
     stopwatch = Stopwatch.StartNew();
 }
开发者ID:sidiandi,项目名称:ttaudio,代码行数:7,代码来源:LogScope.cs

示例7: AssemblyConfiguration

 protected AssemblyConfiguration(Dictionary<string, object> defaultValues, ILog logger)
 {
     NameValueCollection nameValues = ConfigurationManager.AppSettings;
     CreateConfiguration(defaultValues, nameValues);
     foreach (KeyValuePair<string, string> pair in usedValues)
         logger.InfoFormat("Using {0}={1}", pair.Key, pair.Value);
 }
开发者ID:domik82,项目名称:bricks-toolkit,代码行数:7,代码来源:AssemblyConfiguration.cs

示例8: remoteCall

        private static HttpResponse remoteCall( int bufmax, ILog log, HttpWebRequest request )
        {
            HttpWebResponse response;
            try
            {
                response = request.GetResponse() as HttpWebResponse;
            }
            catch (WebException e)
            {
                response = e.Response as HttpWebResponse;
            }
            Stream receiveStream = response.GetResponseStream();
            Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
            StreamReader readStream = new StreamReader(receiveStream, encode);
            Char[] read = new Char[bufmax];
            int count = readStream.Read(read, 0, bufmax);
            if (count == bufmax)
                throw new Exception("buf is small ");

            HttpResponse callRespon = new HttpResponse();
            callRespon.body = new String(read, 0, count);
            callRespon.status = response.StatusCode.ToString();
            log.InfoFormat("[GET] status {0} body:{1}", callRespon.status, callRespon.body);
            response.Close();
            readStream.Close();
            return callRespon;
        }
开发者ID:xcodecraft,项目名称:pylon4net,代码行数:27,代码来源:utls.cs

示例9: LogMessages

 internal static void LogMessages(ILog log)
 {
     log.Info("This is an info");
     log.InfoFormat("Base called at {0}", DateTime.Now);
     log.Debug("This is a debug");
     log.Warn("This is a warning");
     log.Error("This is an error");
 }
开发者ID:Slesa,项目名称:Playground,代码行数:8,代码来源:Program.cs

示例10: Info

        public static void Info(ILog log, string format, params object[] @params)
        {
            if (log == null)
            {
                return;
            }

            log.InfoFormat(format, @params);
        }
开发者ID:MrBretticus,项目名称:JustGiving.EventStore.Http,代码行数:9,代码来源:Log.cs

示例11: CreateBlock

    public static ActionBlock<StatsdMessage> CreateBlock(ITargetBlock<Bucket> target,
      string rootNamespace, 
      bool removeZeroGauges,
      IIntervalService intervalService,
      ILog log)
    {
      var gauges = new ConcurrentDictionary<string, double>();
      var root = rootNamespace;
      var ns = String.IsNullOrEmpty(rootNamespace) ? "" : rootNamespace + ".";

      var incoming = new ActionBlock<StatsdMessage>(p =>
        {
          var gauge = p as Gauge;
          gauges.AddOrUpdate(gauge.Name, gauge.Value, (key, oldValue) => gauge.Value);
        },
        Utility.UnboundedExecution());

      intervalService.Elapsed += (sender, e) =>
        {
          if (gauges.Count == 0)
          {
            return;
          }
          var items = gauges.ToArray();
          var bucket = new GaugesBucket(items, e.Epoch, ns);
          if (removeZeroGauges)
          {
            // Get all zero-value gauges
            double placeholder;
            var zeroGauges = 0;
            for (int index = 0; index < items.Length; index++)
            {
              if (items[index].Value == 0)
              {
                gauges.TryRemove(items[index].Key, out placeholder);
                zeroGauges += 1;
              }
            }
            if (zeroGauges > 0)
            {
              log.InfoFormat("Removed {0} empty gauges.", zeroGauges);
            }
          }
          
          gauges.Clear();
          target.Post(bucket);
        };

      incoming.Completion.ContinueWith(p =>
        {
          // Tell the upstream block that we're done
          target.Complete();
        });
      return incoming;
    }
开发者ID:houcine,项目名称:statsd.net,代码行数:55,代码来源:TimedGaugeAggregatorBlockFactory.cs

示例12: AddInfoLog

        public void AddInfoLog(ILog logger)
        {
            object[] args = new object[4];

            if (!string.IsNullOrEmpty(Data))
            {
                args[0] = LogProcess;
                args[1] = User;
                args[2] = Data;
                args[3] = Message;
                logger.InfoFormat("[{0}] [{1}] [{2}] [{3}]", args);
            }
            else
            {
                args[0] = LogProcess;
                args[1] = User;
                args[2] = Message;
                logger.InfoFormat("[{0}] [{1}] [{2}] ", args);
            }
        }
开发者ID:miyamotomusashi,项目名称:argemsan,代码行数:20,代码来源:LogtrackManager.cs

示例13: ServerHostTestFixture

        // Test-ClassInitialize
        public ServerHostTestFixture()
        {
            this.className = GetType().Name;

            // Set up the log4net configuration.
            BasicConfigurator.Configure();

            this.log = LogManager.GetLogger(className);

            log.InfoFormat("{0} - Initialize", className);
        }
开发者ID:jthelin,项目名称:ServerHost,代码行数:12,代码来源:ServerHostTestFixture.cs

示例14: AssemblyConfiguration

 protected AssemblyConfiguration(string sectionGroup, string sectionName, Dictionary<string, object> defaultValues, ILog logger)
 {
     var nameValues = (NameValueCollection)ConfigurationManager.GetSection(sectionGroup + "/" + sectionName);
     if (logger == null) logger = LogManager.GetLogger(typeof (AssemblyConfiguration));
     if (nameValues == null)
     {
         nameValues = new NameValueCollection();
     }
     CreateConfiguration(defaultValues, nameValues);
     foreach (KeyValuePair<string, string> pair in usedValues)
         logger.InfoFormat("Using {0}={1} for {2}/{3}", pair.Key, pair.Value, sectionGroup, sectionName);
 }
开发者ID:huangzhichong,项目名称:White,代码行数:12,代码来源:AssemblyConfiguration.cs

示例15: GetDeployments

    public static IEnumerable<string> GetDeployments(this IOctopusSession session, Release release, IEnumerable<DeploymentEnvironment> environments, bool force, ILog log)
    {
        var linksToDeploymentTasks = new List<string>();
        foreach (var environment in environments)
        {
            var deployment = session.DeployRelease(release, environment, force);
            var linkToTask = deployment.Link("Task");
            linksToDeploymentTasks.Add(linkToTask);

            log.InfoFormat("Successfully scheduled release {0} for deployment to environment {1}", release.Version, environment.Name);
        }
        return linksToDeploymentTasks;
    }
开发者ID:Jroland,项目名称:Octopus-Tools,代码行数:13,代码来源:DeploymentExtensions.cs


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