protected override void Shutdown()
 {
     lock (syncRoot)
     {
         if (writer != null)
         {
             try
             {
                 if (log == null || log is NullLogger)
                 {
                     log = LogManager.Instance.GetProvider(typeof(FlatFileLogFactory));
                 }
                 log.Log(0, "Shutdown: Flushing and closing log");
                 writer.Flush();
                 writer.Dispose();
                 try
                 {
                     writer.Dispose();
                 }
                 catch
                 { }
                 writer = null;
             }
             catch
             {
                 log.Log(1000, "Shutdown: Failed flushing and closing log");
             }
         }
     }
 }
Exemple #2
0
        private static void Log(string method, LogLevel level, string message)
        {
            if (logger == null)
            {
                logger = LogManager.Instance.GetProvider(typeof(OncorServer));
            }

            if (logger != null)
            {
                logger.Log(method, LogLevel.Info, message);
            }
        }
Exemple #3
0
 public void Start()
 {
     if (this.State == RunState.Stopped || this.State == RunState.Initialized)
     {
         LogProviderBase pp = LogManager.Instance.GetProvider(typeof(OncorHostShim));
         pp.Log(0, "Start: " + svr.State.ToString());
         if (svr.Start())
         {
             this.State = RunState.Running;
         }
         else
         {
             this.State = RunState.FailedStarting;
         }
     }
 }
Exemple #4
0
 public void Initialize()
 {
     if (this.State == RunState.Created || this.State == RunState.FailedInitializing)
     {
         this.State = RunState.Initializing;
         LogProviderBase pp = LogManager.Instance.GetProvider(typeof(OncorHostShim));
         pp.Log(0, "Init: " + svr.State.ToString());
         if (svr.Init())
         {
             this.State = RunState.Initialized;
         }
         else
         {
             this.State = RunState.FailedInitializing;
         }
     }
 }
Exemple #5
0
        static void Main(string[] args)
        {
            ConfigurationManager.Instance.Bootstrap();
            ConfigurationManager.Instance.Initialize();
            ConfigurationManager.Instance.Start();

            LogManager.Instance.Bootstrap();
            LogManager.Instance.Initialize();
            LogManager.Instance.Start();

            if (LogManager.Instance.State == Osrs.Runtime.RunState.Running)
            {
                LogProviderBase prov = LogManager.Instance.GetProvider(typeof(Program));
                if (prov != null)
                {
                    prov.Log("Hi there", LogLevel.Info);
                }
            }
        }