You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael-O <19...@gmx.net> on 2013/05/08 09:01:48 UTC

Print parameters in Tomcat JDBC Pool's SlowQueryReport

Hi,

I recently have started using the SlowQueryReport to tackle performance issues. The log message, unfortunately, does not contain the parameters passed to the prepared statements. Though AbstractQueryReport receives this information in

protected String report*Query(String query, Object[] args, final String name, long start, long delta)

but ignores this information. The report would highly benefit from. E.g., Commons DBUtils prints out the query and the parameters in the case of an exception. The sole query isn't really helpful.

Can we add this? Should I file a ticket?

Thanks,

Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Print parameters in Tomcat JDBC Pool's SlowQueryReport

Posted by Michael-O <19...@gmx.net>.
Am 2013-05-08 19:42, schrieb Christopher Schultz:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Michael,
>
> On 5/8/13 1:14 PM, Michael-O wrote:
>> Christopher,
>>
>> Am 2013-05-08 13:54, schrieb Christopher Schultz:
>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>>>
>>> Michael,
>>>
>>> On 5/8/13 3:01 AM, Michael-O wrote:
>>>> I recently have started using the SlowQueryReport to tackle
>>>> performance issues. The log message, unfortunately, does not
>>>> contain the parameters passed to the prepared statements.
>>>> Though AbstractQueryReport receives this information in
>>>>
>>>> protected String report*Query(String query, Object[] args,
>>>> final String name, long start, long delta)
>>>>
>>>> but ignores this information. The report would highly benefit
>>>> from. E.g., Commons DBUtils prints out the query and the
>>>> parameters in the case of an exception. The sole query isn't
>>>> really helpful.
>>>>
>>>> Can we add this?
>>>
>>> Sure.
>>>
>>>> Should I file a ticket?
>>>
>>> Yes. A BZ issue with a patch is likely to get done a whole lot
>>> faster than one without a patch (plus you get credit for your
>>> contribution).
>>
>> What file should I patch, AbstractQueryReport or QueryReport? I'd
>> exclude JMX for now.
>
> Your choice: whatever seems to make more sense. If a committer reads
> and patch and thinks it goes somewhere else, you can re-write it. Or,
> you can open the BZ issue, then post to the dev list asking for
> suggestions for where to start.

Thanks,

give me a couple of days. I won't have access to an appropriate env 
before Monday.

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Print parameters in Tomcat JDBC Pool's SlowQueryReport

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Michael,

On 5/8/13 1:14 PM, Michael-O wrote:
> Christopher,
> 
> Am 2013-05-08 13:54, schrieb Christopher Schultz:
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>> 
>> Michael,
>> 
>> On 5/8/13 3:01 AM, Michael-O wrote:
>>> I recently have started using the SlowQueryReport to tackle 
>>> performance issues. The log message, unfortunately, does not 
>>> contain the parameters passed to the prepared statements.
>>> Though AbstractQueryReport receives this information in
>>> 
>>> protected String report*Query(String query, Object[] args,
>>> final String name, long start, long delta)
>>> 
>>> but ignores this information. The report would highly benefit 
>>> from. E.g., Commons DBUtils prints out the query and the
>>> parameters in the case of an exception. The sole query isn't
>>> really helpful.
>>> 
>>> Can we add this?
>> 
>> Sure.
>> 
>>> Should I file a ticket?
>> 
>> Yes. A BZ issue with a patch is likely to get done a whole lot
>> faster than one without a patch (plus you get credit for your
>> contribution).
> 
> What file should I patch, AbstractQueryReport or QueryReport? I'd 
> exclude JMX for now.

Your choice: whatever seems to make more sense. If a committer reads
and patch and thinks it goes somewhere else, you can re-write it. Or,
you can open the BZ issue, then post to the dev list asking for
suggestions for where to start.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRio5uAAoJEBzwKT+lPKRYLuwP+wXOVVxKGvPO7GCXZyd/p8bz
g7KZ+wt6cxUpLL/cD2tfBhpFn5rMRHm/40E3P2O62moZOl0cB9ObjL0JaPCGD+Fu
eTf7hqW/ldVsRIOcYaeQZ0hZ0nQXWrQetobcOU1aAZ6tA/OTgzaR1qVZvygzU86H
wEjW9gWQhpnVpjd1M+YrOo4XH48mj1/c2OjHDSMhJhEVgg5qPEmXv5u7hHbdEOyF
ctMx94shFhAhP0PzcJ9Ea71F8zL61cjhbbPr7mVR9SWHCbAol223he6T9nIiuUtO
ABisryyQ8PpN54TCVNHcRhAFXkrkIR6dylhV50FbWJqfjOAhn46L/Q2eHsbeUv4c
hw7RgmE26W4fi86zLPxuvcwLJYDkSe/4dTmBjV7RP6y9UreDcj+5MjuSqcSkQEpl
+B4+R1VnQVv6f3tZ1w9QAB9KbdroHKjDCyb0bnhCSUT6OpKLffU6iz+6N982OVmR
ruOf8+xEIGwbQmj+siFRh6Hb06o6puZOo2O/4ZC3YhEiSoKOkhO48mRzZtAh1mVg
w/X2VQtKZpOGhql3wKU0N+nV3XtO0KB+JGI4V98MTbL9IL4TVtUsd1xgKKoQOc2F
+quRNg1+jRrV718YYjxdATlZLGSsq++GjfLzqZRhoeSlTV4ITwF9NZSKWjFxv0/W
2Zfw/8U+K0B1wBNvvZ+A
=wWhP
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Print parameters in Tomcat JDBC Pool's SlowQueryReport

Posted by Michael-O <19...@gmx.net>.
Christopher,

Am 2013-05-08 13:54, schrieb Christopher Schultz:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Michael,
>
> On 5/8/13 3:01 AM, Michael-O wrote:
>> I recently have started using the SlowQueryReport to tackle
>> performance issues. The log message, unfortunately, does not
>> contain the parameters passed to the prepared statements. Though
>> AbstractQueryReport receives this information in
>>
>> protected String report*Query(String query, Object[] args, final
>> String name, long start, long delta)
>>
>> but ignores this information. The report would highly benefit
>> from. E.g., Commons DBUtils prints out the query and the parameters
>> in the case of an exception. The sole query isn't really helpful.
>>
>> Can we add this?
>
> Sure.
>
>> Should I file a ticket?
>
> Yes. A BZ issue with a patch is likely to get done a whole lot faster
> than one without a patch (plus you get credit for your contribution).

What file should I patch, AbstractQueryReport or QueryReport? I'd 
exclude JMX for now.

Michael


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Print parameters in Tomcat JDBC Pool's SlowQueryReport

Posted by Michael-O <19...@gmx.net>.
Am 2013-05-08 14:08, schrieb Nick Williams:
>
> On May 8, 2013, at 6:54 AM, Christopher Schultz wrote:
>
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>>
>> Michael,
>>
>> On 5/8/13 3:01 AM, Michael-O wrote:
>>> I recently have started using the SlowQueryReport to tackle
>>> performance issues. The log message, unfortunately, does not
>>> contain the parameters passed to the prepared statements. Though
>>> AbstractQueryReport receives this information in
>>>
>>> protected String report*Query(String query, Object[] args, final
>>> String name, long start, long delta)
>>>
>>> but ignores this information. The report would highly benefit
>>> from. E.g., Commons DBUtils prints out the query and the
>>> parameters in the case of an exception. The sole query isn't
>>> really helpful.
>>>
>>> Can we add this?
>>
>> Sure.
>>
>>> Should I file a ticket?
>>
>> Yes. A BZ issue with a patch is likely to get done a whole lot
>> faster than one without a patch (plus you get credit for your
>> contribution).
>>
>> - -chris
>
> There needs to be an option to disable logging query parameters
> somehow. Query parameters are sometimes sensitive, and in some
> environments (medical, legal, etc.) logging them might even be in
> violation of the law.

Agreed, but this won't work if someone failed to use prepared statements 
and uses StringBuilder to create the entire string.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Print parameters in Tomcat JDBC Pool's SlowQueryReport

Posted by Nick Williams <ni...@nicholaswilliams.net>.
On May 8, 2013, at 12:40 PM, Christopher Schultz wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Nick,
> 
> On 5/8/13 1:34 PM, Nick Williams wrote:
>> 
>> On May 8, 2013, at 12:08 PM, Michael-O wrote:
>> 
>>> Am 2013-05-08 14:38, schrieb Christopher Schultz:
>>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>>>> 
>>>> Nick,
>>>> 
>>>> On 5/8/13 8:08 AM, Nick Williams wrote:
>>>>> 
>>>>> On May 8, 2013, at 6:54 AM, Christopher Schultz wrote:
>>>>> 
>>>>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>>>>>> 
>>>>>> Michael,
>>>>>> 
>>>>>> On 5/8/13 3:01 AM, Michael-O wrote:
>>>>>>> I recently have started using the SlowQueryReport to
>>>>>>> tackle performance issues. The log message,
>>>>>>> unfortunately, does not contain the parameters passed to
>>>>>>> the prepared statements. Though AbstractQueryReport
>>>>>>> receives this information in
>>>>>>> 
>>>>>>> protected String report*Query(String query, Object[]
>>>>>>> args, final String name, long start, long delta)
>>>>>>> 
>>>>>>> but ignores this information. The report would highly
>>>>>>> benefit from. E.g., Commons DBUtils prints out the query
>>>>>>> and the parameters in the case of an exception. The sole
>>>>>>> query isn't really helpful.
>>>>>>> 
>>>>>>> Can we add this?
>>>>>> 
>>>>>> Sure.
>>>>>> 
>>>>>>> Should I file a ticket?
>>>>>> 
>>>>>> Yes. A BZ issue with a patch is likely to get done a whole
>>>>>> lot faster than one without a patch (plus you get credit
>>>>>> for your contribution).
>>>>>> 
>>>>>> - -chris
>>>>> 
>>>>> There needs to be an option to disable logging query
>>>>> parameters somehow. Query parameters are sometimes sensitive,
>>>>> and in some environments (medical, legal, etc.) logging them
>>>>> might even be in violation of the law.
>>>> 
>>>> +1
>>>> 
>>>> If you really want to get cute, allow the user to specify named
>>>> query parameters that should never be displayed "e.g.
>>>> 'password'", though this is a) perhaps not possible and b) not
>>>> reliable because you can bind parameters by position as well as
>>>> by name.
>>> 
>>> Java has no support for named parameters. How is that supposed to
>>> work?
>> 
>> Agreed that it the setting won't be effective if they don't use
>> prepared statements. Therefore, the setting name should reflect
>> this restriction.
>> 
>> I'm not sure what Chris is referring to. You are right, Java has no
>> support for named parameters, even in Java 8. Chris might be
>> thinking of Hibernate or Spring's JdbcTemplate, which permit using
>> named parameters. Ultimately, these get converted to indexed
>> parameters before the query is actually executed.
> 
> I'm talking about java.sql.ResultSet.updateFoo(String columnName, Foo
> fooData)
> 
> Or are all your queries SELECTs?

Interesting. My (possible incorrect) understanding of ResultSet.updateFoo is that it does not execute a SQL statement. The database server has the cursored log held in memory and a direct binary message is sent back to update that column on that record. Therefore, there is no SQL statement to be logged by the SlowQueryReport.

My (again, possibly incorrect) understanding of the SlowQueryReport is that it only applies to Statements, PreparedStatements, and CallableStatements. These only have indexed parameters.

Re: Print parameters in Tomcat JDBC Pool's SlowQueryReport

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Nick,

On 5/8/13 1:34 PM, Nick Williams wrote:
> 
> On May 8, 2013, at 12:08 PM, Michael-O wrote:
> 
>> Am 2013-05-08 14:38, schrieb Christopher Schultz:
>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>>> 
>>> Nick,
>>> 
>>> On 5/8/13 8:08 AM, Nick Williams wrote:
>>>> 
>>>> On May 8, 2013, at 6:54 AM, Christopher Schultz wrote:
>>>> 
>>>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>>>>> 
>>>>> Michael,
>>>>> 
>>>>> On 5/8/13 3:01 AM, Michael-O wrote:
>>>>>> I recently have started using the SlowQueryReport to
>>>>>> tackle performance issues. The log message,
>>>>>> unfortunately, does not contain the parameters passed to
>>>>>> the prepared statements. Though AbstractQueryReport
>>>>>> receives this information in
>>>>>> 
>>>>>> protected String report*Query(String query, Object[]
>>>>>> args, final String name, long start, long delta)
>>>>>> 
>>>>>> but ignores this information. The report would highly
>>>>>> benefit from. E.g., Commons DBUtils prints out the query
>>>>>> and the parameters in the case of an exception. The sole
>>>>>> query isn't really helpful.
>>>>>> 
>>>>>> Can we add this?
>>>>> 
>>>>> Sure.
>>>>> 
>>>>>> Should I file a ticket?
>>>>> 
>>>>> Yes. A BZ issue with a patch is likely to get done a whole
>>>>> lot faster than one without a patch (plus you get credit
>>>>> for your contribution).
>>>>> 
>>>>> - -chris
>>>> 
>>>> There needs to be an option to disable logging query
>>>> parameters somehow. Query parameters are sometimes sensitive,
>>>> and in some environments (medical, legal, etc.) logging them
>>>> might even be in violation of the law.
>>> 
>>> +1
>>> 
>>> If you really want to get cute, allow the user to specify named
>>> query parameters that should never be displayed "e.g.
>>> 'password'", though this is a) perhaps not possible and b) not
>>> reliable because you can bind parameters by position as well as
>>> by name.
>> 
>> Java has no support for named parameters. How is that supposed to
>> work?
> 
> Agreed that it the setting won't be effective if they don't use
> prepared statements. Therefore, the setting name should reflect
> this restriction.
> 
> I'm not sure what Chris is referring to. You are right, Java has no
> support for named parameters, even in Java 8. Chris might be
> thinking of Hibernate or Spring's JdbcTemplate, which permit using
> named parameters. Ultimately, these get converted to indexed
> parameters before the query is actually executed.

I'm talking about java.sql.ResultSet.updateFoo(String columnName, Foo
fooData)

Or are all your queries SELECTs?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRio4WAAoJEBzwKT+lPKRY3MsP/3CaNjAgFlEU0kOQX0cpGBQC
LF4+Mq4oGwtB8YOOzr/P6mCSaQC/x2SNoOZiBWv4ZNEw8F82UuEKEW+/UetR9rPL
eumv7g8W6kWxM9v4/GQlF93Onw7qNtGw/eA9j/MyTebCUxQR9Uil+qY1UGZSJGPq
LD1BaGN8Fc12bsYB/WYqCHIThC3zoI+ixley+fTVF0Dc3vc4atgkjmBZmMxE+Rqi
WD66fQuIPOXoM2lBN5Z4motg/vBwcl/0CZs5bAiNSDfXbhMjgN5TRdYESI4eKjCw
bR1/rTRV2uix0UXOJWYW5H9mbccqkdcUs3GHGb9picTUehsmvPP5XCXbdBekiRZE
pbsKeUB/Fx0CDM8yID0jqZdSRe+EHq3PlvbJvvzDWuvGH3ND7ZfwwAkz4kNy4xIK
xwvXDGbjgtThHIfszmaP3K+vdbaTHpX72ejIRspiY4R8zlB4hpl/vNq+lJEZGApH
1PCFyB6SNlKxnl3ssMqSDXEbBcTGF1KFQAiFLzjXzL5KZDwCzmoWloyJp0ZCTL8t
nNhCgicZsGb4NV/0CIDgj2GhHegfwykFkKyawSKZ8jJtvi07FnCHvRwyTjqYJRfR
fORpk45iVmEXnB9W1YWxb8xRlkpzwIo6aVUpNTPazrNawz00yUhbmsUQ54v5tson
utTyDNO+0DXQ6zsWFFu4
=wBws
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Print parameters in Tomcat JDBC Pool's SlowQueryReport

Posted by Nick Williams <ni...@nicholaswilliams.net>.
On May 8, 2013, at 12:08 PM, Michael-O wrote:

> Am 2013-05-08 14:38, schrieb Christopher Schultz:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>> 
>> Nick,
>> 
>> On 5/8/13 8:08 AM, Nick Williams wrote:
>>> 
>>> On May 8, 2013, at 6:54 AM, Christopher Schultz wrote:
>>> 
>>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>>>> 
>>>> Michael,
>>>> 
>>>> On 5/8/13 3:01 AM, Michael-O wrote:
>>>>> I recently have started using the SlowQueryReport to tackle
>>>>> performance issues. The log message, unfortunately, does not
>>>>> contain the parameters passed to the prepared statements.
>>>>> Though AbstractQueryReport receives this information in
>>>>> 
>>>>> protected String report*Query(String query, Object[] args,
>>>>> final String name, long start, long delta)
>>>>> 
>>>>> but ignores this information. The report would highly benefit
>>>>> from. E.g., Commons DBUtils prints out the query and the
>>>>> parameters in the case of an exception. The sole query isn't
>>>>> really helpful.
>>>>> 
>>>>> Can we add this?
>>>> 
>>>> Sure.
>>>> 
>>>>> Should I file a ticket?
>>>> 
>>>> Yes. A BZ issue with a patch is likely to get done a whole lot
>>>> faster than one without a patch (plus you get credit for your
>>>> contribution).
>>>> 
>>>> - -chris
>>> 
>>> There needs to be an option to disable logging query parameters
>>> somehow. Query parameters are sometimes sensitive, and in some
>>> environments (medical, legal, etc.) logging them might even be in
>>> violation of the law.
>> 
>> +1
>> 
>> If you really want to get cute, allow the user to specify named query
>> parameters that should never be displayed "e.g. 'password'", though
>> this is a) perhaps not possible and b) not reliable because you can
>> bind parameters by position as well as by name.
> 
> Java has no support for named parameters. How is that supposed to work?

Agreed that it the setting won't be effective if they don't use prepared statements. Therefore, the setting name should reflect this restriction.

I'm not sure what Chris is referring to. You are right, Java has no support for named parameters, even in Java 8. Chris might be thinking of Hibernate or Spring's JdbcTemplate, which permit using named parameters. Ultimately, these get converted to indexed parameters before the query is actually executed.

Nick

Re: Print parameters in Tomcat JDBC Pool's SlowQueryReport

Posted by Michael-O <19...@gmx.net>.
Am 2013-05-08 14:38, schrieb Christopher Schultz:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Nick,
>
> On 5/8/13 8:08 AM, Nick Williams wrote:
>>
>> On May 8, 2013, at 6:54 AM, Christopher Schultz wrote:
>>
>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>>>
>>> Michael,
>>>
>>> On 5/8/13 3:01 AM, Michael-O wrote:
>>>> I recently have started using the SlowQueryReport to tackle
>>>> performance issues. The log message, unfortunately, does not
>>>> contain the parameters passed to the prepared statements.
>>>> Though AbstractQueryReport receives this information in
>>>>
>>>> protected String report*Query(String query, Object[] args,
>>>> final String name, long start, long delta)
>>>>
>>>> but ignores this information. The report would highly benefit
>>>> from. E.g., Commons DBUtils prints out the query and the
>>>> parameters in the case of an exception. The sole query isn't
>>>> really helpful.
>>>>
>>>> Can we add this?
>>>
>>> Sure.
>>>
>>>> Should I file a ticket?
>>>
>>> Yes. A BZ issue with a patch is likely to get done a whole lot
>>> faster than one without a patch (plus you get credit for your
>>> contribution).
>>>
>>> - -chris
>>
>> There needs to be an option to disable logging query parameters
>> somehow. Query parameters are sometimes sensitive, and in some
>> environments (medical, legal, etc.) logging them might even be in
>> violation of the law.
>
> +1
>
> If you really want to get cute, allow the user to specify named query
> parameters that should never be displayed "e.g. 'password'", though
> this is a) perhaps not possible and b) not reliable because you can
> bind parameters by position as well as by name.

Java has no support for named parameters. How is that supposed to work?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Print parameters in Tomcat JDBC Pool's SlowQueryReport

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Nick,

On 5/8/13 8:08 AM, Nick Williams wrote:
> 
> On May 8, 2013, at 6:54 AM, Christopher Schultz wrote:
> 
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>> 
>> Michael,
>> 
>> On 5/8/13 3:01 AM, Michael-O wrote:
>>> I recently have started using the SlowQueryReport to tackle 
>>> performance issues. The log message, unfortunately, does not 
>>> contain the parameters passed to the prepared statements.
>>> Though AbstractQueryReport receives this information in
>>> 
>>> protected String report*Query(String query, Object[] args,
>>> final String name, long start, long delta)
>>> 
>>> but ignores this information. The report would highly benefit 
>>> from. E.g., Commons DBUtils prints out the query and the
>>> parameters in the case of an exception. The sole query isn't
>>> really helpful.
>>> 
>>> Can we add this?
>> 
>> Sure.
>> 
>>> Should I file a ticket?
>> 
>> Yes. A BZ issue with a patch is likely to get done a whole lot
>> faster than one without a patch (plus you get credit for your
>> contribution).
>> 
>> - -chris
> 
> There needs to be an option to disable logging query parameters 
> somehow. Query parameters are sometimes sensitive, and in some 
> environments (medical, legal, etc.) logging them might even be in 
> violation of the law.

+1

If you really want to get cute, allow the user to specify named query
parameters that should never be displayed "e.g. 'password'", though
this is a) perhaps not possible and b) not reliable because you can
bind parameters by position as well as by name.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRikdbAAoJEBzwKT+lPKRY78UP/RwHLoAjziifH691fQu5NySU
5TeDj0MMeNGzNy4+4ov6Rclhd48XySKYdyecxsqQERM4FLo/e4R/E6BHdURgNSjA
hcfcRk1t6wGiRLn3wykQxNMBWI7JpWN/oUOcVSnXhi3G7xZKAIJfMqVwO2NkoQw2
GBhjKOD4zGRG17CFWD16jG0akm3LttL4OsjuWiRD5UqkkWkkg9JKJKfe6WRSDLnl
2OYw245UCcC37r79gFHZikvVTlu29mbU80tNj0BEK/PlZjzmnfV5gIZCU3kO7njj
0iT3hTrZ3Y1KOEyptyYEdgHDqVxRf02P3y1brDZmq3au7RiZhBwIMQDHqPB7dXaQ
SDqcUHCrNxgKc/O2ydKX+kgbzLE5cCXGzSWK+UMnjxXqekg/utmss5z48P16UJPh
EAyy5GC4C2M1htpYegFba4o3HvWlu0GnM7W0G+dwzZxrREWwfZCs9ggn4lxd36MS
+rEwBtNsATGalfBy//XGJsXJNgUNuGPsD5bT9Yl1QvNidI8yxa91C1X4sz0wYgXY
3+aA++7hDCb8kvkkGqfJiznD8CQVIsZv7RMzCanlE/3ilBPFslJGnVtC/WggFCJx
HQFqeOPnikRaZMqC0n4XTiM1n2sLuKnI+Fki2j+euPdwa5gDxydE+H4eL5WG/6qe
6mE49gaMqyRXugIeO2W1
=ZISZ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Print parameters in Tomcat JDBC Pool's SlowQueryReport

Posted by Nick Williams <ni...@nicholaswilliams.net>.
On May 8, 2013, at 6:54 AM, Christopher Schultz wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Michael,
> 
> On 5/8/13 3:01 AM, Michael-O wrote:
>> I recently have started using the SlowQueryReport to tackle 
>> performance issues. The log message, unfortunately, does not
>> contain the parameters passed to the prepared statements. Though 
>> AbstractQueryReport receives this information in
>> 
>> protected String report*Query(String query, Object[] args, final 
>> String name, long start, long delta)
>> 
>> but ignores this information. The report would highly benefit
>> from. E.g., Commons DBUtils prints out the query and the parameters
>> in the case of an exception. The sole query isn't really helpful.
>> 
>> Can we add this?
> 
> Sure.
> 
>> Should I file a ticket?
> 
> Yes. A BZ issue with a patch is likely to get done a whole lot faster
> than one without a patch (plus you get credit for your contribution).
> 
> - -chris

There needs to be an option to disable logging query parameters somehow. Query parameters are sometimes sensitive, and in some environments (medical, legal, etc.) logging them might even be in violation of the law.

Nick

Re: Print parameters in Tomcat JDBC Pool's SlowQueryReport

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Michael,

On 5/8/13 3:01 AM, Michael-O wrote:
> I recently have started using the SlowQueryReport to tackle 
> performance issues. The log message, unfortunately, does not
> contain the parameters passed to the prepared statements. Though 
> AbstractQueryReport receives this information in
> 
> protected String report*Query(String query, Object[] args, final 
> String name, long start, long delta)
> 
> but ignores this information. The report would highly benefit
> from. E.g., Commons DBUtils prints out the query and the parameters
> in the case of an exception. The sole query isn't really helpful.
> 
> Can we add this?

Sure.

> Should I file a ticket?

Yes. A BZ issue with a patch is likely to get done a whole lot faster
than one without a patch (plus you get credit for your contribution).

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRijzdAAoJEBzwKT+lPKRYIwkP/jqRuNAegMYMBKXm33KqjblZ
U8k4JMGM4sCGBjcZjoyawN0u0MF2mRSdznxnDxghtmoc8byoxraNLiZ4p3DHvJv3
XC8/DATQEyVj2CaWAcSNqZq5uN3+jjx+2faa7G6hq1VJ8dfaA0ljcD9cfruGXxv+
OEFeMsWsY8IxR3JclQAsgRp05mCD9FN215pGDlwUdGn6l4dSPYFiEMGTW1b4QSFx
ga8TFi7XKfbzT3Rn0NdTh4qUQzprk/4C8tTlcVRvycHm16zrW8tnUZ5RGn80REaB
yGPScZkKLD5F1rCS5jUg7Ylyz1eTvi31iY7EdoMF1uVY7lpMpsymRPUwyhVbIoW3
5UUBcphnL4MW0IeDq6NfdwKVKPuG5frpuZc65ppeW/GEdPEi2mMwFw8gXA8X+kkj
AOsoPCBpdLxyXsyDaFKFf8QnADwBIgQ2srCqLAwRNvPwNpAFtRcaeymAWN6xcst9
tWucgYWLRFKTNcwigMw4c2bBtnNiPJXx0utBcOZZWZZPonc9jyASN/SpIJd6Pb05
lrpl0uxjlWcJy7o/p+2pKE8q6jjBaqQgBH7oijMNUZDsfv2mDLIbiKk/IUvRTg6a
g0qysIUwubRSjdwOlFigkdStsGKj3ned9wbpcu12RFhMhJx2Aan4dHa1rNS6q7Vb
kIMv6VXcgiY/NUMKlj39
=r0L4
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org