gavlyukovskiy/spring-boot-data-source-decorator

Getting empty results

sleyzerzon opened this issue · 3 comments

I configured a spring boot starter as per instructions

## p6spy ###
# Register P6LogFactory to log JDBC events
decorator.datasource.p6spy.enable-logging=true
decorator.datasource.datasource-proxy.query.log-level=debug
decorator.datasource.datasource-proxy.slow-query.enable-logging=true
decorator.datasource.datasource-proxy.slow-query.log-level=warn
decorator.datasource.datasource-proxy.slow-query.logger-name=
# Use com.p6spy.engine.spy.appender.MultiLineFormat instead of com.p6spy.engine.spy.appender.SingleLineFormat
decorator.datasource.p6spy.multiline=true
# Use logging for default listeners [slf4j, sysout, file]
decorator.datasource.p6spy.logging=slf4j
# Log file to use (only with logging=file)
decorator.datasource.p6spy.log-file=spy.log
# Custom log format, if specified com.p6spy.engine.spy.appender.CustomLineFormat will be used with this log format
decorator.datasource.p6spy.log-format=

		<dependency>
			<groupId>com.github.gavlyukovskiy</groupId>
			<artifactId>p6spy-spring-boot-starter</artifactId>
			<version>1.5.8</version>
		</dependency>

but getting some empty output from p6spy:

2019-12-24 16:22:13.103 DEBUG 11672 --- [ntainer#0-0-C-1] o.s.jdbc.core.JdbcTemplate               : Executing prepared SQL query
2019-12-24 16:22:13.103 DEBUG 11672 --- [ntainer#0-0-C-1] o.s.jdbc.core.JdbcTemplate               : Executing prepared SQL statement [SELECT COMIT_ID FROM DPL_PARTY.USR_DTL WHERE INDVDL_ID = (SELECT INDVDL_ID FROM DPL_PARTY.INDVDL_TLCMMNCTN WHERE EML_VAL = ?)]
2019-12-24 16:22:13.181  INFO 11672 --- [ntainer#0-0-C-1] p6spy                                    : 
2019-12-24 16:22:13.182 DEBUG 11672 --- [ntainer#0-0-C-1] c.s.a.repository.UserRepository          : Obtained comitId=XBBKRHL for email of niren.sinha@bnymellon.com from the DB.
2019-12-24 16:22:13.286  INFO 11672 --- [ntainer#0-0-C-1] p6spy                                    : 

The query themselves execute fine. What am I missing here? Thanks.

Hi @sleyzerzon, as states you need to remove decorator.datasource.p6spy.log-format=. Same with other properties, I put them there to show all available properties with default values, but as far as defaults are good for you there is no need to copy them into your application.properties

Hi @gavlyukovskiy, indeed it works when that line is removed as you pointed out. Perhaps it could be an additional feature if the decorator validates against an empty input like this and uses some more reasonable defaults if it finds one. Thanks.