Пример #1
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static int Main()
        {
            CrashLog.RegisterUnhandledExceptionHandler();

            s_Log = NLogBasedPlainLog.Instance;
            s_Log.Info("NWheels Windows Service Host version {0}", typeof(Program).Assembly.GetName().Version);

            try
            {
                LoadNodeHostConfig();
                s_Log.ConfigureWindowsEventLogOutput(logName: "Application", sourceName: s_BootConfig.ApplicationName + "." + s_BootConfig.NodeName);
            }
            catch ( Exception e )
            {
                s_Log.Critical("FAILED TO LOAD {0}: {1}", BootConfiguration.DefaultBootConfigFileName, e.Message);
                return 1;
            }

            var servicesToRun = new ServiceBase[] {
                new WindowsService()
            };

            ServiceBase.Run(servicesToRun);
            return 0;
        }
Пример #2
0
 //-----------------------------------------------------------------------------------------------------------------------------------------------------
 public ThreadLogAppender(IFramework framework, IThreadLogAnchor anchor, IThreadRegistry registry, IPlainLog plainLog)
 {
     _framework = framework;
     _anchor = anchor;
     _registry = registry;
     _plainLog = plainLog;
 }
Пример #3
0
        //-----------------------------------------------------------------------------------------------------------------------------------------------------
        static int Main(string[] args)
        {
            CrashLog.RegisterUnhandledExceptionHandler();

            _s_log = NLogBasedPlainLog.Instance;
            _s_log.ConfigureConsoleOutput();

            _s_log.Info("NWheels Console Host version {0}", typeof(Program).Assembly.GetName().Version);

            try
            {
                LoadBootConfig(args);
            }
            catch ( Exception e )
            {
                _s_log.Critical("FAILED TO LOAD BOOT CONFIG: {0}", e.Message);
                return 1;
            }

            try
            {
                StartNodeHost();
            }
            catch ( Exception e )
            {
                _s_log.Critical("NODE FAILED TO START! {0}", e.ToString());
                return 2;
            }

            BlockUntilStopRequested();

            try
            {
                StopNodeHost();
            }
            catch ( Exception e )
            {
                _s_log.Warning("NODE WAS NOT CORRECTLY STOPPED! {0}", e.ToString());
            }

            return 0;
        }