GlobalExceptions.cs 488 B

12345678910111213141516
  1. using System;
  2. using Library;
  3. using Microsoft.AspNetCore.Mvc.Filters;
  4. namespace MySystem
  5. {
  6. public class GlobalExceptions : IExceptionFilter
  7. {
  8. public void OnException(ExceptionContext context)
  9. {
  10. string Message = context.Exception.Message;
  11. string StackTrace = context.Exception.StackTrace;
  12. function.WriteLog(DateTime.Now.ToString() + "\r\n" + Message + "\r\n" + StackTrace, "Global全局异常处理日志");
  13. }
  14. }
  15. }