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


C# log4net.ILog.InfoFormat方法代码示例

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


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

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

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

示例3: Main

        static void Main(string[] args)
        {
            try
            {
                basePath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                addresses = System.Net.Dns.GetHostAddresses(System.Net.Dns.GetHostName());

                string url = "/Btnm/LocalPlatform";
                string addr = "tcp://127.0.0.1:7070";


                foreach (string ss in args)
                {
                    if (ss.StartsWith("--Url=", StringComparison.InvariantCultureIgnoreCase))
                    {
                        url = ss.Substring("--Url=".Length);
                    }
                    else if (ss.StartsWith("--Address=", StringComparison.InvariantCultureIgnoreCase))
                    {
                        addr = ss.Substring(10);
                    }
                    else if (ss.StartsWith("--MaxSize=", StringComparison.InvariantCultureIgnoreCase))
                    {
                        maxSize = int.Parse(ss.Substring(10));
                    }
                }


                XmlSetting xmlSetting = new XmlSetting(new StreamReader(Path.Combine(basePath, "nanrui.modul.config")));
                defaultSetting = XmlSetting.ReadFromFile(Path.Combine(basePath, "../nanrui.default.config"));

                log4net.Config.XmlConfigurator.Configure(xmlSetting.SelectOne("/configuration/log4net").AsXmlNode() as System.Xml.XmlElement);
                logger = log4net.LogManager.GetLogger("Betanetworks");

                try
                {
                    cachePath = Path.Combine(basePath, "cache");
                    profix = defaultSetting.ReadSetting("/configuration/Locale/PrefixId/@value", profix);
                    corporation = defaultSetting.ReadSetting("/configuration/Locale/Corporation/@value", corporation);
                    uploadForPCAgent = "true" == xmlSetting.ReadSetting("/configuration/Locale/UploadForPCAgent/@value", "false");
                    uploadForBadLink = "true" == xmlSetting.ReadSetting("/configuration/Locale/UploadForBadLink/@value", "false");
                    supportMultCPU = "true" == xmlSetting.ReadSetting("/configuration/Locale/SupportMultCPU/@value", "false");
                    logger.InfoFormat("配置发送程序启动,缺省前缀 '{0}',缺省公司 '{1}'", profix, corporation);

                    logger.Info("载入设备指标映射!");
                    DispatchImpl.ReadDispatch(xmlSetting.SelectOne("/configuration/Maps/Device"), _deviceDispatcher, logger);
                    
                    logger.Logger.Log(typeof(Dispatcher), log4net.Core.Level.Trace, "载入要发送的设备备注列表!", null);
                    ReadMap(_deviceFields, xmlSetting.Select("/configuration/Locale/DeviceFields/*"));
                    
                    logger.Logger.Log(typeof(Dispatcher), log4net.Core.Level.Trace, "载入設備的公司列表!", null);
                    ReadIni(_corporationIPSeg, xmlSetting.Select("/configuration/Locale/Corporations/*"));
                    
    //<Corporations>
    //  <IPAddress from="" to="" value="" />
    //</Corporations>

                    

                    Dictionary<string, XmlContainer> dict = new Dictionary<string, XmlContainer>();

                    logger.Info("开始读设备表!");

                        IList<Device> devices = Device.FindBy<Device>(null);

                        logger.Info("读设备表完成,开始处理!");


                        foreach (Device dev in devices)
                        {
                            XmlContainer xmlContainer = null;
                            switch (dev.Catalog)
                            {
                                case 1: //交换机
                                    logger.InfoFormat("开始处理交换机{0}:{1}:{2}!", dev.Id, dev.Address, dev);
                                    xmlContainer = processSW(dev, dict);
                                    break;
                                case 2://路由器
                                    logger.InfoFormat("开始处理路由器{0}:{1}:{2}!", dev.Id, dev.Address, dev);
                                    xmlContainer = processRT(dev, dict);
                                    break;
                                case 3://交换路由器
                                    logger.InfoFormat("开始处理交换路由器{0}:{1}:{2}!", dev.Id, dev.Address, dev);
                                    xmlContainer = processSW(dev, dict);
                                    break;
                                default:
                                    logger.InfoFormat("跳过未知设备{0}:{1}:{2}!", dev.Id, dev.Address, dev);
                                    break;
                            }

                            if (null != xmlContainer)
                            {
                                _deviceByIds[dev.Id] = dev;
                                clearXml(xmlContainer, dict);
                            }

                        }

                        logger.Info("处理设备表完成,开始读线路表!");

//.........这里部分代码省略.........
开发者ID:Redi0,项目名称:meijing-ui,代码行数:101,代码来源:Program.cs

示例4: Main

        static void Main(string[] args)
        {
            _log = log4net.LogManager.GetLogger(typeof(Program));

            //onetime stuff
            RadarHttpClient.DefaultRequestHeaders.Accept.Clear();
            RadarHttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            //get directory from config
            //TODO: change this to read from config

            //NOTES:
            //file name is batch ID - use to retreive batch to assign details.
            // also use to determine company ID of sheet.

            var curDir = Directory.GetCurrentDirectory();

            _log.InfoFormat("running in {0}", curDir);

            var xlsxFiles = Directory.GetFiles(curDir, "*.xlsx");

            if (!xlsxFiles.Any())
            {
                _log.InfoFormat("No xlsx files found in {0}", curDir);
            }
            else
            {
                //go get column positions from DB.
                _prodTask = new UowPRODTask();
                _mapping = _prodTask.Template.GetAllWithInclude(t => t.TemplateMapping)
                    .Where(t => t.AuditStatusCode == Radar.Core.Common.Constants.StatusCode.Audit.ACTIVE)
                    .Select(t => t);

                foreach (var xlsxFile in xlsxFiles)
                {
                    processFile(xlsxFile);
                }
            }

            // import only supports XLSX files... right?

            Console.Write("Press <enter> key to exit");
            Console.ReadLine();
        }
开发者ID:snabbas,项目名称:importpoc2,代码行数:44,代码来源:Program.cs


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