[英]Spring Data MongoDB Connection Logging
Is there a way of checking if a mongo connection has been successfully opened during app deployment? 有没有办法检查应用程序部署期间是否已成功打开mongo连接?
I am not having any connection input returned on logs. 我没有在日志上返回任何连接输入。
I have this on my log4j properties. 我在log4j属性上有这个。
log4j.category.org.springframework.data.mongodb=TRACE
I only get this on my trace related to mongo. 我只在与mongo相关的跟踪上得到这个。
DEBUG [RMI TCP Connection(2)-127.0.0.1] (MongoPersistentEntityIndexCreator.java:122) - Analyzing class class com.marcoremane.spring.entity.Client for index information.
I am doing XML based configurations 我正在做基于XML的配置
<mongo:mongo-client id="mongoClient" host="127.0.0.1" port="27017">
<mongo:client-options connect-timeout="1000"/>
</mongo:mongo-client>
<mongo:db-factory id="mongoDbFactory" dbname="minib" mongo-ref="mongoClient"/>
<mongo:template db-factory-ref="mongoDbFactory"/>
Try switching on Log4j2 internal logging: 尝试打开Log4j2内部日志记录:
<Configuration status="trace">
Log4j2 internal logging statements will be printed to the console. Log4j2内部日志记录语句将打印到控制台。 This should include success or failure of database connectivity.
这应该包括数据库连接的成功或失败。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.