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


C# Logger.Trace方法代码示例

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


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

示例1: Main

        static void Main()
        {
            Config = new ServiceConfig().Load();
            Logger = LogManager.GetCurrentClassLogger();

            try
            {
                Host = new WebHost();
                Host.Start();

                Logger.Trace("Сервис запущен");

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                Application.Run(new FormService());

                Logger.Trace("Сервис остановлен");
            }
            catch (Exception ex)
            {
                Program.Logger.Error(ex.Message);
                Application.Exit();
            }
        }
开发者ID:kindprojects,项目名称:workstation,代码行数:25,代码来源:Program.cs

示例2: FileProvider

        public FileProvider()
        {
            _logger = LogManager.GetCurrentClassLogger();

            var appData = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            _logger.Trace("AppData: " + appData);
            _settingsFolderPath = Path.Combine(appData, "MergeToolSelector");
            _logger.Trace("Settings folder path: " + _settingsFolderPath);
        }
开发者ID:jayotterbein,项目名称:MergeToolSelector,代码行数:9,代码来源:FileProvider.cs

示例3: Run

        private int Run()
        {
            Bootstrap();
            _logger = _container.Resolve<Logger>();

            var exitCode = HostFactory.Run(host =>
            {
                host.Service<RefreshService>(svc =>
                {
                    svc.ConstructUsing(() =>
                    {
                        var agent = new RefreshService(RefreshInterval, () => _container.Resolve<RabbitMonitorRepository>() as RabbitMonitorRepository);

                        agent.OnReport += (s, e) => _logger.Trace(e.Data);
                        agent.OnError += (s, e) => _logger.Fatal(e.Data);

                        return agent;
                    });

                    svc.WhenStarted(a => a.Start());
                    svc.WhenStopped(a => a.Stop());
                });

                host.SetDescription("Refresh Service Agent for RabbitMQ");
                host.SetDisplayName("RabbitMQ Refresh Agent");
                host.SetServiceName("RabbitMQRefreshAgent");
                host.RunAsNetworkService();
            });

            return (int)exitCode;
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:31,代码来源:Program.cs

示例4: Execute

        /// <summary>
        /// Called by the <see cref="T:Quartz.IScheduler"/> when a <see cref="T:Quartz.ITrigger"/>
        ///             fires that is associated with the <see cref="T:Quartz.IJob"/>.
        /// </summary>
        /// <remarks>
        /// The implementation may wish to set a  result object on the
        ///             JobExecutionContext before this method exits.  The result itself
        ///             is meaningless to Quartz, but may be informative to
        ///             <see cref="T:Quartz.IJobListener"/>s or
        ///             <see cref="T:Quartz.ITriggerListener"/>s that are watching the job's
        ///             execution.
        /// </remarks>
        /// <param name="context">The execution context.</param>
        public void Execute(IJobExecutionContext context)
        {
            _logger = LogManager.GetCurrentClassLogger();

            JobDataMap dataMap = context.JobDetail.JobDataMap;
            EconomicReleaseUpdateJobSettings settings;
            try
            {
                settings = JsonConvert.DeserializeObject<EconomicReleaseUpdateJobSettings>((string)dataMap["settings"]);
            }
            catch (Exception e)
            {
                _logger.Error(e, "Failed to deserialize data update job settings");
                return;
            }

            _logger.Info($"Data Update job {settings.Name} triggered.");

            _broker.Error += _broker_Error;

            var startDate = DateTime.Now.AddBusinessDays(-settings.BusinessDaysBack);
            var endDate = DateTime.Now.AddBusinessDays(settings.BusinessDaysAhead);
            var req = new EconomicReleaseRequest(startDate, endDate, dataLocation: DataLocation.ExternalOnly, dataSource: settings.DataSource);
            var releases = _broker.RequestEconomicReleases(req).Result; //no async support in Quartz, and no need for it anyway, this runs on its own thread
            _logger.Trace($"Economic release update job downloaded {releases.Count} items");

            JobComplete();
        }
开发者ID:leo90skk,项目名称:qdms,代码行数:41,代码来源:EconomicReleaseUpdateJob.cs

示例5: Main

        static void Main(string[] args)
        {
            Database.SetInitializer<AwpContext>(null);
            Database.SetInitializer<OenContext>(null);
            Database.SetInitializer<HeatContext>(null);

            try
            {
                Container = Bootstrap();

                Runner = Container.Resolve<IJobsRunner>() as JobsRunner;
                Runner.Title = "Automated Warming Process - Warmer Agent";
                Runner.StartTime = DateTime.Now;

                Log = Container.Resolve<Logger>();

                Console.WriteLine("**************************************************************************");
                Console.WriteLine("*");
                Console.WriteLine("* {0} ", Runner.Title);
                Console.WriteLine("* Date: {0} ", Runner.StartTime);
                Console.WriteLine("*");
                Console.WriteLine("* Usage:");
                Console.WriteLine("*");
                Console.WriteLine("*    Warmer [-options] where options are:");

                JobsRunner.CommandLineOptions.ToList().ForEach(x => Console.WriteLine("*         {0}", x));

                Console.WriteLine("*");
                Console.WriteLine("**************************************************************************");
                Console.WriteLine("\n\n\n");

                Log.Trace("Starting the Process with Command Line: {0}", args.Dump());

                PrepareRunner();
                Runner.ParseCommandLine(args);
                Runner.SetDefaultValuesForSettings();
                Runner.BuildJobs();
                Runner.ApplySettings();

                Run();
            }
            catch (Exception e)
            {
                Log.Fatal(e.Message);
            }

            Console.WriteLine("\n\n\n");
            Console.WriteLine("**************************************************************************");
            Console.WriteLine("*");
            Console.WriteLine("* Duration: {0} ", Runner.Duration);
            Console.WriteLine("*");
            Console.WriteLine("**************************************************************************");
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                Console.ReadLine();   
            }
#endif
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:59,代码来源:Program.cs

示例6: Scheduler

 /// <summary>
 /// Initializes a new instance of the <see cref="Scheduler"/> class.
 /// </summary>
 /// <param name="tasks">The tasks.</param>
 /// <param name="internalCheckInterval">The internal check interval (in seconds).</param>
 public Scheduler(SchedulerTask[] tasks, int internalCheckInterval = 120)
 {
     _tasks = tasks;
     _internalCheckInterval = internalCheckInterval;
     _cache = HttpRuntime.Cache;
     _logger = LogManager.GetLogger("SchedulerTask");
     _logger.Trace("Scheduler created.");
 }
开发者ID:vlko,项目名称:vlko,代码行数:13,代码来源:Scheduler.cs

示例7: DockableToolwindowPresenter

 protected DockableToolwindowPresenter(VBE vbe, AddIn addin, IDockableUserControl view)
 {
     _vbe = vbe;
     _addin = addin;
     _logger = LogManager.GetCurrentClassLogger();
     _logger.Trace(string.Format("Initializing Dockable Panel ({0})", GetType().Name));
     UserControl = view as UserControl;
     _window = CreateToolWindow(view);
 }
开发者ID:retailcoder,项目名称:Rubberduck,代码行数:9,代码来源:DockableToolwindowPresenter.cs

示例8: Main

        static void Main(string[] args)
        {
            logger = LogManager.GetCurrentClassLogger();
            DependencyFactory.RegisterDependency<IMathSolver, MathSolver>();
            logger.Trace("Logger Created");

            IMathSolver solver = DependencyFactory.Resolve<IMathSolver>();
            solver.DoComplexTimeTakingCalculation();
            Console.ReadLine();
        }
开发者ID:yadavvineet,项目名称:NLog101,代码行数:10,代码来源:Program.cs

示例9: Main

        /// <summary>
        /// Point d'entrée.
        /// </summary>
        static void Main(string[] args)
        {
            _logger = LogManager.GetLogger("Program");
            if (!Environment.UserInteractive)
            {
                #region Considère un contexte de service
                ServiceBase[] ServicesToRun;
                ServicesToRun = new ServiceBase[]
                {
                    new Service.MemcachedService()
                };
                ServiceBase.Run(ServicesToRun);
                #endregion
            }
            else
            {
                #region Considère un contexte utilisateur (interactif)
                _logger.Trace("Mode interactif");
                int exitCode = 0;
                try
                {
                    #region Parse la ligne de commande
                    Options options = new Options();
                    ICommandLineParser parser = new CommandLineParser(new CommandLineParserSettings(false, true, Console.Error));
                    bool parserSucceed = parser.ParseArguments(args, options);
                    #endregion

                    if (options.Install || options.Uninstall)
                    {
                        if (!parserSucceed)
                            throw new ArgumentException("Ligne de commande invalide.");
                        Service.MemcachedServiceInstaller.Install(options.Uninstall, args);
                        return;
                    }

                    using (var service = new Service.MemcachedService())
                    {
                        service.SetUp(!parserSucceed ? args.Length != 0 ? args : AppSettings.GetMemcachedArguments() : AppSettings.GetMemcachedArguments());
                        _logger.Info("Service démarré. Appuyez sur ECHAP pour mettre fin au service...");

                        while (!NativeMethods.PeekEscapeKey()) { }
                        _logger.Info("[ESC]");
                        service.TearDown();
                    }
                }
                catch (Exception ex)
                {
                    _logger.Fatal(ex.ToString());
                    exitCode = -1;
                }
                Environment.Exit(exitCode);
                #endregion
            }
        }
开发者ID:eric-b,项目名称:MemcachedService64,代码行数:57,代码来源:Program.cs

示例10: TCPTransportFactory

        public TCPTransportFactory(ClientConfig configuration, ISerializer serializer, IRequestBalancer reqBalancer)
        {
            logger = LogManager.GetLogger("TCPTransportFactory");
            this.config = configuration;
            serverIP = IPAddress.Parse(config.ServerIP);
            serverPort = Convert.ToInt16(config.ServerPort);
            balancer = reqBalancer;
            CreateAndPreparePool(configuration.GetServerList());
            this.serializer = serializer;

            if (logger.IsTraceEnabled)
            {
                foreach (IPEndPoint ep in configuration.GetServerList())
                    logger.Trace("server list : " + ep.Address.ToString() + ":" + ep.Port);
            }
        }
开发者ID:sunimalr,项目名称:dotnet-client,代码行数:16,代码来源:TCPTransportFactory.cs

示例11: NetworkCredential

        public SuppressionFilesController
        (
            ISuppressionFilesRequestValidator validator,

            SettingsProvider settings,
            Logger logger
        )
        {
            Logger = logger;
            Logger.Trace("Initializing WebAPI Service...");

            _validator = validator;

            _settings = settings;
            _powerUser = new NetworkCredential(_settings.PowerUserName, _settings.PowerUserPassword, _settings.PowerUserDomain);
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:16,代码来源:SuppressionFilesController.cs

示例12: Application_Start

        protected void Application_Start()
        {
            try
            {
                log = LogManager.GetCurrentClassLogger();

                AreaRegistration.RegisterAllAreas();

                WebApiConfig.Register(GlobalConfiguration.Configuration);
                FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
                RouteConfig.RegisterRoutes(RouteTable.Routes);

                log.Trace("Application was started");

            }
            catch (Exception e)
            {
                log.ErrorException("Exeption during start application: " + e.Message, e);
            }
        }
开发者ID:katrine2013,项目名称:ExpenseTrackingSystem,代码行数:20,代码来源:Global.asax.cs

示例13: TCPTransport

 public TCPTransport(IPAddress server, int serverPort)
 {
     this.serverIP = server;
     this.serverPort = serverPort;
     logger = LogManager.GetLogger("TCPTransport");
     try
     {
         tcpClient = new TcpClient();
         tcpClient.Connect(server, serverPort);
         this.buff = new BufferedStream(tcpClient.GetStream());
         this.bWriter = new BinaryWriter(buff);
         this.bReader = new BinaryReader(tcpClient.GetStream());
         String message = string.Format("Connected to server :" + server.ToString() + " : " + serverPort);
         logger.Trace(message);
     }
     catch (Exception e)
     {
         String message = string.Format("Could not connect to server :" + server.ToString() + " : " + serverPort);
         logger.Warn("Infinispan.DotNetClient", message);
         throw new TransportException(message, e);
     }
 }
开发者ID:mmarkus,项目名称:dotnet-client,代码行数:22,代码来源:TCPTransport.cs

示例14: Main

        static void Main(string[] args)
        {            
            ConfigurationItemFactory.Default.Targets.RegisterDefinition("SignalTarget", typeof(SignalTarget));
            Logger = LogManager.GetCurrentClassLogger(typeof(SignalTarget));
            var rnd = new Random((int)DateTime.Now.Ticks);

            for (int i = 0; i < 100; i++) {
                Logger.Trace("Sample trace message from NLog");
                Logger.Debug("Sample debug message from NLog");
                Logger.Info("Sample informational message from NLog");
                Logger.Warn("Sample warning message from NLog");
                Logger.Error("Sample error message from NLog", new Exception("Something bad happened!"));
                Logger.Fatal("Sample fatal error message from NLog");

                var sleep = rnd.Next(20, 250);
                Console.WriteLine(string.Concat("Sleeping...:", sleep, "ms"));
                Thread.Sleep(sleep);
            }

            Console.WriteLine("Logging Complete. Press enter to continue...");
            Console.ReadLine();
        }
开发者ID:Cloudish-OSS,项目名称:Cloudish.LoggingExtensions,代码行数:22,代码来源:Program.cs

示例15: TCPTransport

        public TCPTransport(IPEndPoint endPoint)
        {
            ipEndPoint = endPoint;
            logger = LogManager.GetLogger("TCPTransport");
            try
            {
                tcpClient = new TcpClient();
                tcpClient.Connect(ipEndPoint.Address, ipEndPoint.Port);
                // tcpClient.Connect(IPAddress.Loopback, 11222);
                this.buff = new BufferedStream(tcpClient.GetStream());
                this.bWriter = new BinaryWriter(buff);
                this.bReader = new BinaryReader(tcpClient.GetStream());
                String message = string.Format("Connected to server :" + ipEndPoint.Address.ToString() + " : " + ipEndPoint.Port);

                logger.Trace(message);
            }
            catch (Exception e)
            {
                String message = string.Format("Could not connect to server :" + ipEndPoint.Address.ToString() + " : " + ipEndPoint.Port);
                logger.Warn("Infinispan.DotNetClient", message);
                throw new TransportException(message, e);
            }
        }
开发者ID:sunimalr,项目名称:dotnet-client,代码行数:23,代码来源:TCPTransport.cs


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