Example #1
0
 private static void LogException(Exception exception)
 {
     try
     {
         Log4NetHelper.All(logger => logger.Error(exception.ToString()));
     }
     catch
     {
         // ignored
     }
 }
        public Response <string> Log()
        {
            const string MSG = "WcfService.Log";

            Log4NetHelper.All(x => x.Fatal(MSG));

            return(new Response <string>
            {
                Item = MSG
            });
        }
Example #3
0
 static void AppDomainException(object sender, UnhandledExceptionEventArgs e)
 {
     try
     {
         var exception = (Exception)e.ExceptionObject;
         Log4NetHelper.All(x => x.Error("AppDomain Unhandled exception", exception));
     }
     catch
     {
         // ignored
     }
 }
        public bool HandleError(Exception error)
        {
            try
            {
                Log4NetHelper.All(logger => logger.Error(error.ToString()));
            }
            catch
            {
                // ignored
            }

            return(false);
        }
Example #5
0
        protected override void OnStart(string[] args)
        {
            Log4NetHelper.All(x => x.Info("DataAnalysisService.Start"));

            try
            {
                this._dataAnalysis = new DataAnalysis(this._settings);
                this._thread       = new Thread(this.Run);
                this._thread.Start();
            }
            catch (Exception ex)
            {
                Log4NetHelper.All(x => x.Error("An error occurred while starting service.", ex));
            }
        }
Example #6
0
        protected override void OnStop()
        {
            Log4NetHelper.All(x => x.Info("DataAnalysisService.Stop"));

            var sleepTime   = this._settings.SleepTime;
            var extraTime   = (long)(sleepTime.Ticks * 1.5); // Adds an extra time to ensure that the process will finish successfully
            var waitTimeout = sleepTime + new TimeSpan(extraTime);

            try
            {
                this._manualResetEvent.Set();
                this._thread.Join(waitTimeout);
            }
            catch (Exception ex)
            {
                Log4NetHelper.All(x => x.Error("An error occurred while stopping service.", ex));
            }
        }