I have a Spring Application which is using JPA/Hibernate. I want to track every insert and update statement in the DB. Is it possible to log the data update to a file and output a new file everyday. Basically if something changes in the database I want to track it in a log file. And there needs to be one log file everyday. I do have log4.xml in my application. Besides this I dont know where to begin. Any suggestions. tips solutions and pointers to good references are greatly appreciated.
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
In the hibernate configuration, set show sql property to true and then redirect hibernate logs to a file using some logging API
References : Hibernate show real SQL
It is possible to log every sql fired by hibernate. you can have a rolling file configuration to get a new file every day. refer: http://logging.apache.org/log4j/1.2/manual.html I hope this helps.
it is very easy, add a new appender to your log4j config file.
Example: