如何禁用Esper的avro.EventTypeAvroHandlerFactory警告?
解决Esper Avro相关重复警告的方法
方案一:通过日志配置屏蔽指定类的警告
该警告来自com.espertech.esper.common.internal.event.avro.EventTypeAvroHandlerFactory类,直接在项目的日志配置文件中把这个类的日志级别设为OFF或ERROR即可屏蔽警告:
Logback配置示例
<logger name="com.espertech.esper.common.internal.event.avro.EventTypeAvroHandlerFactory" level="OFF"/>
Log4j2配置示例
<Logger name="com.espertech.esper.common.internal.event.avro.EventTypeAvroHandlerFactory" level="OFF" additivity="false"/>
方案二:通过Esper配置明确禁用Avro支持
在初始化Esper时,通过Configuration对象直接关闭Avro支持,从根源避免该警告触发:
Configuration configuration = new Configuration(); // 禁用Avro事件类型支持 configuration.getCommon().getEventMeta().getAvro().setEnabled(false); // 只需要获取一次Runtime,避免重复初始化 EPRuntime runtime = EPRuntimeProvider.getDefaultRuntime(configuration); EPEventService eventService = runtime.getEventService();
内容的提问来源于stack exchange,提问作者Dakotah North
相关产品推荐
相关产品推荐

