简体   繁体   English

如何在错误日志级别模式下运行mongodb实例?

[英]How to run mongodb instance in ERROR log level mode?

Not able to run mongodb instance in ERROR log level. 无法在错误日志级别运行mongodb实例。 As defined by mongodb documentation, by default verbosity is 0 which includes information messages. 根据mongodb文档的定义,默认的详细程度为0,其中包括信息消息。 But increasing verbosity to 1-5 will include debug level messages. 但是,将详细程度提高到1-5将包含调试级别的消息。 I need only error messages to be logged in my log file. 我只需要将错误消息记录在我的日志文件中即可。 I am currently using mongodb-3.6.3 version with java driver at client side. 我目前在客户端使用带有Java驱动程序的mongodb-3.6.3版本。

Is there any way to do it? 有什么办法吗? If yes, how to achieve this? 如果是,该如何实现? I've already tried reducing logs by adding quiet = true in the config file. 我已经尝试通过在配置文件中添加quiet = true来减少日志。 But still, a lot of unnecessary logs are generated. 但是仍然会生成许多不必要的日志。

在运行任何MongoRepository查询之后,将此行添加到application.properties文件,并检查控制台输出。

logging.level.org.springframework.data.mongodb.core.MongoTemplate=ERROR

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

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