use of org.seasar.doma.jdbc.JdbcLogger in project sandbox by irof.
the class AppConfig method getJdbcLogger.
@Override
public JdbcLogger getJdbcLogger() {
// 無名クラスじゃダメな理由として、このメソッド呼ばれるたびにインスタンスつくるのもどうなのというのもある。
return new AbstractJdbcLogger<Level>(Level.INFO) {
@Override
protected void log(Level level, String callerClassName, String callerMethodName, Throwable throwable, Supplier<String> messageSupplier) {
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
Logger logger = loggerContext.getLogger(callerClassName);
int levelInt = Level.toLocationAwareLoggerInteger(level);
logger.log(null, callerClassName, levelInt, messageSupplier.get(), null, null);
}
@Override
protected void logTransactionBegun(String callerClassName, String callerMethodName, String transactionId, Level level, Supplier<String> messageSupplier) {
super.logTransactionBegun(callerClassName, callerMethodName, transactionId, Level.DEBUG, messageSupplier);
}
@Override
protected void logTransactionEnded(String callerClassName, String callerMethodName, String transactionId, Level level, Supplier<String> messageSupplier) {
super.logTransactionEnded(callerClassName, callerMethodName, transactionId, Level.DEBUG, messageSupplier);
}
};
}
Aggregations