简体   繁体   English

如何禁用导入库中的日志记录?

[英]How to disable logging in imported libraries?

In my application, I am using SLF4J's Logger for logging.在我的应用程序中,我使用 SLF4J 的Logger进行记录。 When an error is logged, I am sending a message to another application.记录错误时,我正在向另一个应用程序发送消息。 The problem is that one of the libraries I use (Slack API) uses the same logger (in class com.slack.api.methods.impl.TeamIdCache ), so when it logs an error, my application sends a message that I didn't intend it to send.问题是我使用的库之一(Slack API)使用相同的记录器(在类com.slack.api.methods.impl.TeamIdCache中),所以当它记录错误时,我的应用程序发送一条消息,我没有'不打算发送。

How can I disable that library's logger?如何禁用该库的记录器?

You can disable specific logger in your application properties:您可以在应用程序属性中禁用特定的记录器:

logging.level.com.slack.api.methods.impl.TeamIdCache=OFF

See Spring documentation for more information regarding other configuration options and log levels.有关其他配置选项和日志级别的更多信息,请参阅Spring 文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM