Esempio n. 1
0
        public IActionResult Index()
        {
            ElmahExtensions.RiseError(new InvalidOperationException("This is the Test Exception from code."));

            _logger.LogTrace("Test");
            _logger.LogDebug("Test");
            _logger.LogError("Test");
            _logger.LogInformation("Test");
            _logger.LogWarning("Test");
            _logger.LogCritical(new InvalidOperationException("Test"), "Test");

            ElmahExtensions.RiseError(new NullReferenceException());

            if (DateTime.Now.Millisecond < 500)
            {
                string str = null;
                // ReSharper disable once PossibleNullReferenceException
                foreach (var cc in str)
                {
                    Debug.WriteLine(cc);
                }
            }

            var r = 0;
            // ReSharper disable once UnusedVariable
            // ReSharper disable once IntDivisionByZero
            var d = 100 / r;

            return(View());
        }
Esempio n. 2
0
 /// inheritDoc
 public void HandleEvent(AbpHandledExceptionData eventData)
 {
     if (eventData.Exception != null && !eventData.Exception.IsExceptionLogged())
     {
         ElmahExtensions.RiseError(eventData.Exception);
         eventData.Exception.MarkExceptionAsLogged();
     }
 }
Esempio n. 3
0
 public async Task <bool> tryCommitAsync()
 {
     try { await commitAsync(); }
     catch (Exception e)
     {
         ElmahExtensions.RiseError(e);
         new InvalidOperationException("exception", e);
         return(false);
     }
     return(true);
 }
Esempio n. 4
0
 public async Task Invoke(HttpContext context)
 {
     try
     {
         await _next.Invoke(context);
     }
     catch (Exception ex)
     {
         ElmahExtensions.RiseError(new Exception(ex.Message, ex.InnerException));
     }
 }
Esempio n. 5
0
        protected override void Append(LoggingEvent loggingEvent)
        {
            var exception = loggingEvent.ExceptionObject;

            if (exception == null || loggingEvent.ExceptionObject.IsExceptionLogged())
            {
                return;
            }

            ElmahExtensions.RiseError(exception);
        }
Esempio n. 6
0
        public IActionResult Index()
        {
            /*_logger.LogTrace("Test");
             * _logger.LogDebug("Test");
             * _logger.LogError("Test");
             * _logger.LogInformation("Test");
             * _logger.LogWarning("Test");*/
            _logger.LogCritical(new InvalidOperationException("Test"), "Test");
            ElmahExtensions.RiseError(new Exception("test2"));
            var r = 0;
            // ReSharper disable once UnusedVariable
            // ReSharper disable once IntDivisionByZero
            var d = 100 / r;

            return(View());
        }
Esempio n. 7
0
 public static void ManageExceptionContext(Exception ex)
 {
     ElmahExtensions.RiseError(ex);
 }