Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log Agroal 'Connection acquired without transaction.' warning with stack trace right away #21832

Merged
merged 1 commit into from
Dec 1, 2021
Merged

Log Agroal 'Connection acquired without transaction.' warning with stack trace right away #21832

merged 1 commit into from
Dec 1, 2021

Conversation

famod
Copy link
Member

@famod famod commented Nov 30, 2021

Rationale: #18946 (comment)

Before:

2021-11-30 22:36:36,985 WARN  [io.agr.pool] (main) Datasource '<default>': Connection acquired without transaction.
2021-11-30 22:36:36,985 DEBUG [io.agr.pool] (main) Cause: : java.sql.SQLException: Connection acquired without transaction.
        at io.agroal.pool.ConnectionPool.afterAcquire(ConnectionPool.java:351)
        at io.agroal.pool.ConnectionPool.getConnection(ConnectionPool.java:245)
        at io.agroal.pool.DataSource.getConnection(DataSource.java:86)
        [...]

After:

2021-12-01 00:36:30,688 WARN  [io.agr.pool] (main) Datasource '<default>': java.sql.SQLException: Connection acquired without transaction.
        at io.agroal.pool.ConnectionPool.afterAcquire(ConnectionPool.java:351)
        at io.agroal.pool.ConnectionPool.getConnection(ConnectionPool.java:245)
        at io.agroal.pool.DataSource.getConnection(DataSource.java:86)
        [...]

The exception message check is far from pretty, but I don't see another way due to the lack of a dedicated listener method.
It would be nice if such a method could be added to a future Agroral release, /cc @barreiro.

@geoand geoand requested a review from gsmet December 1, 2021 07:15
Copy link
Member

@Sanne Sanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks nice, thanks @famod .

@Sanne Sanne merged commit 9d5f9cb into quarkusio:main Dec 1, 2021
@quarkus-bot quarkus-bot bot added this to the 2.6 - main milestone Dec 1, 2021
@famod famod deleted the agroal-tx-req-loqqing branch December 1, 2021 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants