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


C# ILog.DebugFormat方法代码示例

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


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

示例1: Main

 static void Main(string[] args)
 {
     Logger = LogManager.GetLogger("default");
     try
     {
         Logger.DebugFormat("Server powered up");
         Logger.DebugFormat("Loading configuration");
         ConfigManager.LoadConfigs();
         string addr = ConfigManager.GetConfig("GameServer.ListenAddress");
         string port = ConfigManager.GetConfig("GameServer.ListenPort");
         Logger.DebugFormat("Trying to listen at {0}:{1}", addr, port);
         TcpListener listener = new TcpListener(new IPEndPoint(IPAddress.Parse(addr), Convert.ToInt32(port)));
         listener.Start();
         while (true)
         {
             TcpClient client = listener.AcceptTcpClient();
             ClientServant servant = new ClientServant(client);
             Program.Logger.DebugFormat("New client connected from: {0}", servant.ClientIPEndPoint);
             servant.Start();
         }
     }
     catch (Exception e)
     {
         Logger.FatalFormat("Unhandled exception: {0}, stacktrace: {1}", e.Message, e.StackTrace);
         Logger.Fatal("Server shutdown");
     }
 }
开发者ID:hoxily,项目名称:Wuziqi,代码行数:27,代码来源:Program.cs

示例2: LoadConfigurationFromFile

        /// <summary>
        ///     Opens a config file on disk.
        /// </summary>
        /// <param name="configFilePath">Path to external config file.</param>
        /// <param name="log">Log4Net ILog implementation</param>
        /// <returns>
        ///     Settings parsed from <paramref name="configFilePath" />.
        /// </returns>
        private static Settings LoadConfigurationFromFile(string configFilePath, ILog log)
        {
            log.DebugFormat("Attempting to load settings from external configuration file '{0}'", configFilePath);
            var fileMap = new ConfigurationFileMap(configFilePath);
            var configuration = ConfigurationManager.OpenMappedMachineConfiguration(fileMap);
            var section = (NewRelicConfigurationSection) configuration.GetSection("newRelic");
            var settingsFromConfig = Settings.FromConfigurationSection(section, log);
            log.DebugFormat("Settings loaded successfully");

            return settingsFromConfig;
        }
开发者ID:jamierytlewski,项目名称:newrelic_microsoft_sqlserver_plugin,代码行数:19,代码来源:ConfigurationParser.cs

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

示例4: WindowsServiceRunner

        /// <summary>
        /// Executes the provided IWindowsServices and supports automatic installation using the command line params -install / -uninstall
        /// </summary>
        /// <param name="args"></param>
        /// <param name="createServices">Function which provides a WindowsServiceCollection of services to execute</param>
        /// <param name="configureContext">Optional application context configuration</param>
        /// <param name="installationSettings">Optional installer configuration with semi-sensible defaults</param>
        /// <param name="registerContainer">Optionally register an IoC container</param>
        /// <param name="agentSettingsManager">Optionally provide agent settings </param>
        public WindowsServiceRunner(string[] args,
            Func<IWindowsService[]> createServices,
            Action<ApplicationContext> configureContext = null,
            Action<System.ServiceProcess.ServiceInstaller,
            ServiceProcessInstaller> installationSettings = null,
            Func<IIocContainer> registerContainer = null,
            IAgentSettingsManager agentSettingsManager = null,
            Action<ApplicationContext,string> notify=null)
        {
            _notify = notify ?? ((ctx,message) => { });
            var log = LogManager.GetLogger(typeof (WindowsServiceRunner));
            _args = args;
            _context = new ApplicationContext();
            _createServices = createServices;
            _agentSettingsManager = agentSettingsManager;
            _logger = log;
            _configureContext = configureContext ?? (ctx => {  });
            _context.ConfigureInstall = installationSettings ?? ((serviceInstaller, serviceProcessInstaller) => { });
            _context.Container = registerContainer;

            if (registerContainer==null)
            {
                throw new ArgumentException("Binding container is null");
            }
            if (registerContainer != null)
            {
                _logger.DebugFormat("container is " + registerContainer.ToString());
            }
        }
开发者ID:andrewmyhre,项目名称:DeployD,代码行数:38,代码来源:WindowsServiceRunner.cs

示例5: GetSettingsFromAppConfig

 private static Settings GetSettingsFromAppConfig(ILog log)
 {
     log.Debug("No external configuration path given, attempting to load settings from from default configuration file");
     var section = (NewRelicConfigurationSection) ConfigurationManager.GetSection("newRelic");
     var settingsFromAppConfig = Settings.FromConfigurationSection(section,log);
     log.DebugFormat("Settings loaded successfully");
     return settingsFromAppConfig;
 }
开发者ID:jamierytlewski,项目名称:newrelic_microsoft_sqlserver_plugin,代码行数:8,代码来源:ConfigurationParser.cs

示例6: Debug

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

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

示例7: WriteSiteCohorts

        /// <summary>
        /// Write the list of cohorts at a site to a log.
        /// </summary>
        public static void WriteSiteCohorts(ILog       log,
            ActiveSite site)
        {
            if (cohorts == null)
                cohorts = Model.Core.GetSiteVar<ISiteCohorts>("Succession.BiomassCohorts");

            int count = 0;  // # of species with cohorts
            foreach (ISpeciesCohorts speciesCohorts in cohorts[site])
            {
                string cohort_list = "";
                foreach (ICohort cohort in speciesCohorts)
                {
                    cohort_list += string.Format(", {0} yrs ({1})", cohort.Age, cohort.Biomass);
                }
                log.DebugFormat("      {0}{1}", speciesCohorts.Species.Name, cohort_list);
                count += 1;
            }
            if (count == 0)
                log.DebugFormat("      (no cohorts)");
        }
开发者ID:LANDIS-II-Foundation,项目名称:Library-Biomass-Harvest,代码行数:23,代码来源:Debug.cs

示例8: CustomizationManagerBase

        /// <summary>
        /// Initializes a new instance of the <see cref="CustomizationManagerBase&lt;T&gt;"/> class.
        /// </summary>
        /// <param name="composer">The composer.</param>
        /// <param name="fileSystem">The file system.</param>
        protected CustomizationManagerBase(IDirectoryBasedComposer composer, IFileSystem fileSystem)
        {
            if (composer == null) throw new ArgumentNullException("composer");
            if (fileSystem == null) throw new ArgumentNullException("fileSystem");

            _composer = composer;
            _fileSystem = fileSystem;
            Log = LogManager.GetLogger(GetType());

            Customizers = new List<ICustomizeReactorInitialization>();

            if (Log.IsDebugEnabled) Log.DebugFormat("There were {0} customizers found", Customizers.Count());
        }
开发者ID:akilhoffer,项目名称:Reactor,代码行数:18,代码来源:CustomizationManagerBase.cs

示例9: EdgeAreasAndBulbsPointGenerator

        public EdgeAreasAndBulbsPointGenerator(string directory, string filename)
        {
            _log = LogManager.GetLogger(GetType());

            _log.Info("Loading edge areas from file");

            var listReader = new AreaListReader(directory, filename);

            _edgeAreas = listReader
                .GetAreas()
                .ToList();
            _log.DebugFormat("Loaded {0:N0} edge areas", _edgeAreas.Count);
        }
开发者ID:ajalexander,项目名称:Fractals,代码行数:13,代码来源:EdgeAreasAndBulbsPointGenerator.cs

示例10: AuthenticationHttpMoudle

 public AuthenticationHttpMoudle()
 {
     _logger = new DefaultLoggerFactory().GetLogger();
     _logger.DebugFormat("AuthenticationHttpMoudle创建新的实例");
     _userService = ServiceLocationHandler.Resolver<IUserService>();
     _desCrypto = new DesCrypto("hhyjuuhd", "mmnjikjh");
     _systemAuthenticationHandlers = new List<IAuthenticationHandler>();
     _systemAuthenticationHandlers.Add(new DefaultAuthenticationHandler());
     _customAuthenticationHandlers = new List<IAuthenticationHandler>();
     var customHandler = ServiceLocationHandler.Resolver<IAuthenticationHandler>(false);
     if (customHandler != null)
         _customAuthenticationHandlers.Add(customHandler);
 }
开发者ID:chenchunwei,项目名称:Infrastructure,代码行数:13,代码来源:AuthenticationHttpMoudle.cs

示例11: Main

        static void Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();
            log = LogManager.GetLogger("NotifyNow");

            NotifyMessage message = null;

            try
            {
                message = NotifyMessage.ProcessArgs(args);
            }
            catch (Exception ex)
            {
                log.Error("Exception calling ProcessArgs", ex);
            }

            using (var bus = RabbitHutch.CreateBus(ConfigurationManager.ConnectionStrings["RabbitMQ"].ConnectionString))
            {
                if (String.IsNullOrEmpty(message.Message) == false)
                {
                    using (var channel = bus.OpenPublishChannel())
                    {
                        log.DebugFormat("Publishing message: {0}", message.Message);
                        channel.Publish(message);
                    }
                }

                if (SingleInstance.SingleApplication.Run())
                {
                    // First instance, create the Main Window
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    var f = new MainWindow(bus);
                    f.FormBorderStyle = FormBorderStyle.FixedToolWindow;
                    f.ShowInTaskbar = false;
                    f.StartPosition = FormStartPosition.Manual;
                    f.Location = new System.Drawing.Point(-2000, -2000);
                    f.Size = new System.Drawing.Size(1, 1);

                    Application.Run(f);
                    Application.Exit();
                }
                else
                {
                    // App already running, exit now
                    Application.Exit();
                }
            }
        }
开发者ID:richard-green,项目名称:NotifyNow,代码行数:50,代码来源:Program.cs

示例12: PluginDriver

        public PluginDriver()
        {
            m_logger = LogManager.GetLogger(string.Format("PluginDriver:{0}", m_sessionId));

            m_properties = new SessionProperties(m_sessionId);

            // Add the user information object we'll be using for this session
            UserInformation userInfo = new UserInformation();
            m_properties.AddTrackedSingle<UserInformation>(userInfo);

            // Add the plugin tracking object we'll be using for this session
            PluginActivityInformation pluginInfo = new PluginActivityInformation();
            pluginInfo.LoadedAuthenticationGatewayPlugins = PluginLoader.GetOrderedPluginsOfType<IPluginAuthenticationGateway>();
            pluginInfo.LoadedAuthenticationPlugins = PluginLoader.GetOrderedPluginsOfType<IPluginAuthentication>();
            pluginInfo.LoadedAuthorizationPlugins = PluginLoader.GetOrderedPluginsOfType<IPluginAuthorization>();
            m_properties.AddTrackedSingle<PluginActivityInformation>(pluginInfo);

            m_logger.DebugFormat("New PluginDriver created");
        }
开发者ID:MutonUfoAI,项目名称:pgina,代码行数:19,代码来源:PluginDriver.cs

示例13: ExecuteScriptIfFoundInPackage

        private void ExecuteScriptIfFoundInPackage(DeploymentContext context, string scriptPath, ILog logger)
        {
            var file = context.Package.GetFiles().SingleOrDefault(f => f.Path.Equals(scriptPath, StringComparison.InvariantCultureIgnoreCase));

            if (file == null)
            {
                return;
            }

            logger.DebugFormat("Found script {0}, executing...", scriptPath);

            try
            {
                LoadAndExecuteScript(context, Path.Combine(context.WorkingFolder, file.Path), logger);
            }
            catch (Exception ex)
            {
                logger.Fatal("Failed executing powershell script " + file.Path, ex);
            }
        }
开发者ID:repne,项目名称:DeployD,代码行数:20,代码来源:PowershellDeploymentHook.cs

示例14: OnStart

        protected override void OnStart(string[] args)
        {
            log = LogManager.GetLogger(typeof(ATStrategySvc));

            if (serviceHost != null)
            {
                log.Info("Service restarting");
                serviceHost.Close();
            }

            log.Info("Loading configuration");
            Dictionary<string, string> settings = GetConfiguration();
            log.DebugFormat("Loaded {0} configuration values", settings.Count);

            serviceHost = new ServiceHost(new AlgoTrader.strategy.ThreeDucksStrategy(settings));

            //serviceHost = new ServiceHost(typeof(AlgoTrader.strategy.ThreeDucksStrategy));
            log.Info("Service starting");
            serviceHost.Open();
            log.Info("Service started");
        }
开发者ID:bra5047,项目名称:psugv-500-team4,代码行数:21,代码来源:ATStrategySvc.cs

示例15: MemCacheProvider

 static MemCacheProvider()
 {
     log = LogManager.GetLogger(typeof (MemCacheProvider));
     var configs = ConfigurationManager.GetSection("memcache") as MemCacheConfig[];
     if (configs != null)
     {
         var myWeights = new ArrayList();
         var myServers = new ArrayList();
         foreach (MemCacheConfig config in configs)
         {
             myServers.Add(string.Format("{0}:{1}", config.Host, config.Port));
             if (log.IsDebugEnabled)
             {
                 log.DebugFormat("adding config for memcached on host {0}", config.Host);
             }
             if (config.Weight > 0)
             {
                 myWeights.Add(config.Weight);
             }
         }
         servers = (string[]) myServers.ToArray(typeof (string));
         weights = (int[]) myWeights.ToArray(typeof (int));
     }
 }
开发者ID:pruiz,项目名称:nhibernate-contrib-old,代码行数:24,代码来源:MemCacheProvider.cs


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