Currently I'm working with the Spring Boot project where properties are defined in the YML file, like that:
logging:
level:
org:
hibernate:
SQL: DEBUG
What I need to do is to retrieve the message from the debug log (to be specific: a query which is executed by Hibernate after hitting particular endpoint) and save that message as a String value, to the DB.
I tried with the following:
@Value("${logging.level.org.hibernate.SQL}")
private String logMessage;
Unfortunately, with that I can only display "DEBUG" String.
After I changed the @Value like this...
@Value("${logging.level.org.hibernate.SQL.DEBUG}")
private String logMessage;
...I got an error.
Can you please advise me on how to write it down in a correct manner, to see the exact message from the debug log?
Or maybe there are some better ways to achieve that?
I've already tried with requestLoggingFilter() method, but I couldn't find any option to retrieve the exact Hibernate (SQL) query with that...
Thank you in advance for any help!
Kind regards, Matt