diff --git a/pom.xml b/pom.xml index 26357d6..0085b6a 100644 --- a/pom.xml +++ b/pom.xml @@ -169,13 +169,6 @@ - - - org.bgee.log4jdbc-log4j2 - log4jdbc-log4j2-jdbc4 - 1.16 - - com.googlecode.json-simple json-simple diff --git a/src/main/java/cokr/xit/adds/core/support/logback/ExcludeLogFilter.java b/src/main/java/cokr/xit/adds/core/support/logback/ExcludeLogFilter.java index 3f11f54..262dab3 100644 --- a/src/main/java/cokr/xit/adds/core/support/logback/ExcludeLogFilter.java +++ b/src/main/java/cokr/xit/adds/core/support/logback/ExcludeLogFilter.java @@ -23,9 +23,9 @@ import ch.qos.logback.core.spi.FilterReply; public class ExcludeLogFilter extends Filter { @Override public FilterReply decide(ILoggingEvent event) { - if (event.getMessage().contains("==> Preparing:") - || event.getMessage().contains("==> Parameters:") - || event.getMessage().contains("org.hibernate.SQL") + if (//event.getMessage().contains("==> Preparing:") + //|| event.getMessage().contains("==> Parameters:") + event.getMessage().contains("org.hibernate.SQL") || event.getMessage().contains("org.hibernate.type.descriptor.sql") || event.getMessage().contains(". PreparedStatement.") ) { diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 014a0e5..e42f877 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -106,6 +106,8 @@ springdoc: # enable-logging: true logging: + # sql log format define + config: classpath:logback-spring.xml pattern: console: '%d{yyyy-MM-dd HH:mm:ss.SSS} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr([%18.18thread]){magenta}[traceId=%X{request_trace_id}] %clr([%-35.35logger{35}::%-25.25method{25}:%4line]){cyan} %clr(%m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}){faint}' file: '%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} [%18.18thread][traceId=%X{request_trace_id}] [%-35.35logger{35}::%-25.25method{25}:%4line] %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}' @@ -113,13 +115,11 @@ logging: root: info web: debug cokr.xit: debug - log4jdbc.log4j2: info - # org.springframework.jdbc.core: debug - # org.springframework.jdbc.connection.init: debug # log file file: path: ${app.data.root.path}/logs name: ${spring.application.name} + --- spring: config: @@ -140,17 +140,6 @@ spring: schema-locations: classpath:database/schema.sql # data-locations: classpath:database/data.sql -# datasource: -# hikari: -# driver-class-name: org.h2.Driver -# jdbc-url: jdbc:h2:~/test;AUTO_SERVER=true;MODE=MySQL;DATABASE_TO_LOWER=TRUE -# # jdbc-url: jdbc:h2:mem:xitdb;MODE=MySQL;DATABASE_TO_LOWER=TRUE -# #jdbc-url: jdbc:h2:tcp://localhost:9092/mem:testdb;MODE=MySQL;DATABASE_TO_LOWER=TRUE -# username: sa -# password: -# auto-commit: false -# read-only: false - app: swagger: url: diff --git a/src/main/resources/log4jdbc.log4j2.properties b/src/main/resources/log4jdbc.log4j2.properties new file mode 100644 index 0000000..b12a5d1 --- /dev/null +++ b/src/main/resources/log4jdbc.log4j2.properties @@ -0,0 +1,3 @@ +log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator +log4jdbc.dump.sql.maxlinelength=0 +log4jdbc.drivers=org.mariadb.jdbc.Driver diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index a36425d..3962b28 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -32,6 +32,18 @@ ${CONSOLE_LOG_CHARSET} + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss} - SQL:\n%msg%n + ${CONSOLE_LOG_CHARSET} + + @@ -106,6 +118,15 @@ + + + + + + + + + @@ -118,20 +139,13 @@ - + + + - + - - - - - - - - -