How do I suppress the 'Returning cached instance of singleton bean' logging message in Spring/Java? Is there a good reference for this somewhere? Thanks.
The "Returning cached instance of singleton bean" message is logged by Spring at DEBUG level (by AbstractBeanFactory
). Spring logs a lot of messages at DEBUG level, by design. If you're viewing your log files at this level, then they're invariably going to be full of log noise as Spring chunters along doing its thing.
You can't suppress specific messages with log4j, the best you can do is suppress specific loggers. However, viewing logs at DEBUG level is just not a good idea unless you're debugging, when you're looking for messages on what Spring's doing deep inside.
For normal work, you should be putting a threshold of INFO on your log files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With