Class LoggingExceptionHandler

java.lang.Object
cloud.opencode.base.event.handler.LoggingExceptionHandler
All Implemented Interfaces:
EventExceptionHandler

public class LoggingExceptionHandler extends Object implements EventExceptionHandler
Logging Exception Handler 日志异常处理器

Default exception handler that logs errors without interrupting processing.

默认的异常处理器,记录错误但不中断处理。

Features | 主要功能:

  • Error logging - 错误日志记录
  • Non-interrupting - 不中断处理
  • Configurable log level - 可配置的日志级别

Usage Examples | 使用示例:

EventExceptionHandler handler = new LoggingExceptionHandler();
// or with custom level
EventExceptionHandler handler = new LoggingExceptionHandler(System.Logger.Level.WARNING);

Security | 安全性:

  • Thread-safe: No - 线程安全: 否
Since:
JDK 25, opencode-base-event V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • LoggingExceptionHandler

      public LoggingExceptionHandler()
      Create logging handler with default ERROR level 使用默认ERROR级别创建日志处理器
    • LoggingExceptionHandler

      public LoggingExceptionHandler(System.Logger.Level logLevel)
      Create logging handler with specified level 使用指定级别创建日志处理器
      Parameters:
      logLevel - the log level | 日志级别
  • Method Details

    • handleException

      public void handleException(Event event, Throwable exception, String listenerName)
      Handle exception by logging it 通过记录日志处理异常
      Specified by:
      handleException in interface EventExceptionHandler
      Parameters:
      event - the event being processed | 正在处理的事件
      exception - the exception that occurred | 发生的异常
      listenerName - the name of the listener that threw | 抛出异常的监听器名称