Good afternoon! I need to create functionality that would allow me to measure the start/end time and duration of the query. I tried using the log4j library and creating my own logger, but I can't specify it in applicationSpringContext. Maybe someone could advise how to approach this issue correctly ? And what tools could I use for such tasks? Thank you very much for your help! MyLogger:
package net.proselyte.springbootdemo;
import org.hibernate.engine.internal.StatisticalLoggingSessionEventListener;
import org.jboss.logging.Logger;
public class NewStatisticalLoggingSessionEventListener extends StatisticalLoggingSessionEventListener {
private static final Logger log = Logger.getLogger(NewStatisticalLoggingSessionEventListener.class);
@Override
public void jdbcExecuteStatementStart() {
//Write method
}
@Override
public void jdbcPrepareStatementEnd() {
//Write method
}
}
MyApplicationContext when i try to add:
logging.level.net.proselyte.springbootdemo.NewStatisticalLoggingSessionEventListener=info
my task should have this output :
startTime=2020-09-18 Time 10:30:1231
endTime=2020-09-18 Time 10:30:2500
requestExecutionTime=60;
success/unsuccess