關閉TransactionSynchronizationManager下日誌列印
阿新 • • 發佈:2019-01-30
目前的專案日誌中經常出現一串日誌會佔用好幾行,目前使用者到所以想不列印這些:
2017-07-08 11:35:39,358 DEBUG SaveLogThread org.springframework.transaction.support.TransactionSynchronizationManager - Removed value [org.springframework.jdbc.datasource.ConnectionHolder@7442c5c3] for key [{
CreateTime:"2017-07-08 11:28:18",
ActiveCount:1 ,
PoolingCount:4,
CreateCount:5,
DestroyCount:0,
CloseCount:26,
ConnectCount:27,
Connections:[
{ID:1052278721, ConnectTime:"2017-07-08 11:28:19", UseCount:1, LastActiveTime:"2017-07-08 11:35:35"},
{ID:1120630802, ConnectTime:"2017-07-08 11:28:19", UseCount:2, LastActiveTime:"2017-07-08 11:35:36" },
{ID:444289640, ConnectTime:"2017-07-08 11:28:19", UseCount:10, LastActiveTime:"2017-07-08 11:35:39"},
{ID:1010305024, ConnectTime:"2017-07-08 11:28:19", UseCount:8, LastActiveTime:"2017-07-08 11:35:39"}
]
}] from thread [SaveLogThread]
百度了一下沒有找到設定 traceEnabled的地方
- 方法1:
在配置檔案裡把所有spring日誌全都關閉,應該還可以更具體點
log4j.logger.org.springframework = error
- 方法2:
通過與其他沒有此類日誌的專案對比,發現加上commons-logging1.1.2jar包就可以了