I have several JPA repositories in a package and I want to log queries of only one specific repository. I know there are following properties in spring:
But these properties log sql statements of all the repositories. I want these properties to work only for given repository. Is there a way in spring to configure for such requirement?
There is no such feature in Spring. What you could do is writing a wrapper or a proxy, wrapping the repositories in question and before each call setting a value in the MDC and use that for filtering by writing an EvaluatorFilter accessing the MDC of the ILoggingEvent
Something similar should be possible with other Logging frameworks.
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