? ? Success

User tests: Successful: Unsuccessful:

avatar Bakual
Bakual
17 Jun 2015

Based on dicussions in #7183

Background

Currently, our database drivers are logging database query errors to the category databasequery.
However to actually see those appear in a log, you need to have several conditions met.

Rant

I'm not even sure exactly as I got confused a lot while testing. I think you need to have global debug enabled and in the debug plugin also the "log queries" option enabled. But today it didn't work anymore for me. So I'm not sure how I got them to appear yesterday.

Solution

With this PR the errros would be logged as a new category "databasequeryerror", which will be logged as soon as you have the "Log Almost Everything" parameter enabled in the debug plugin.
With global debug on, you will get the query errors logged twice, because debug will try to run the query again in "explain" mode. That should be fine.

This PR also removes the logging which we introduced with some recently merged PRs. This is no longer neeeded.
It also adjusts the tooltip for the category parameter in the plugin. I thought it may be worth to add the category to the list there.

Testing

  • Change a query so it fails. I just renamed the table name in the admin stats module (https://github.com/joomla/joomla-cms/blob/staging/administrator/modules/mod_stats_admin/helper.php#L84) to #__user. This module is loaded in the Control Panel by default if you have testing data installed so it was a simple test for me. But any query should work.
  • Enable logging in the debug plugin. The most important is the "Log Almost Everything".
  • Load the page and see if any errors are logged in the Joomla logfiles.
  • Apply PR and load the page again. You now should see the database query error logged in the "logs/everything.php" logfile.
avatar Bakual Bakual - open - 17 Jun 2015
avatar nikosdion
nikosdion - comment - 17 Jun 2015

I'm not sure if you should remove the extra logging. These messages were logged as "controller", not as "databasequery". It's possible that I'm debugging an issue with my controllers and since I don't want to sift through massive logs I may choose to only log "controller" messages. With the change I'd have to somehow know that I need to log both controller and databasequeryerror messages to debug the controller.

IMHO it's best to log the same message twice under two different contexts than requiring the developer to magically know that he should be looking for an irrelevant context to what they're currently debugging.

avatar mbabker
mbabker - comment - 17 Jun 2015

@Bakual I'm gonna nitpick for a moment and suggest you just call the new category "databaseerror", the current choice is rather excessively verbose in my opinion.

@nikosdion IIRC those log statements were added when all the "handle DB error" PRs were merged, so it's all new stuff and I think based on my comment in #7183 they were added since there wasn't awareness of the existing logging in the database API. Plus contextually a lot of the categories are wrong anyway (why are modules and plugins logging to the controller category?).

avatar Bakual
Bakual - comment - 17 Jun 2015

@nikosdion These logging I removed only were merged yesterday. So there is no B/C yet with that.
See 5bbb0ed and 06b38e2
The controller category was probably not the best choice to begin with and using a specific category makes it easier to only filter for errors. Together with adding it to the tooltip it should be possible to figure out how to get them.

avatar Bakual
Bakual - comment - 17 Jun 2015

I'm gonna nitpick for a moment and suggest you just call the new category "databaseerror", the current choice is rather excessively verbose in my opinion.

True that. Going to change :+1:

avatar brianteeman
brianteeman - comment - 17 Jun 2015

is it possible to change the name to add hyphenation to increase readbility

  • it is always hard to read two words joined together especially when the joining letter is the same eg change to database-error from databaseerror

On 17 June 2015 at 14:06, Thomas Hunziker notifications@github.com wrote:

I'm gonna nitpick for a moment and suggest you just call the new category
"databaseerror", the current choice is rather excessively verbose in my
opinion.

True that. Going to change [image: :+1:]


Reply to this email directly or view it on GitHub
#7187 (comment).

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar joomla-cms-bot joomla-cms-bot - change - 17 Jun 2015
Labels Added: ? ?
avatar Bakual
Bakual - comment - 17 Jun 2015

Changed to database-error
Seemed to work fine for me. Logging to file as well as the display part (with filtering).

avatar zero-24 zero-24 - change - 17 Jun 2015
Category Libraries
avatar zero-24 zero-24 - change - 17 Jun 2015
Status New Pending
Easy No Yes
avatar wilsonge wilsonge - change - 23 Jun 2015
Milestone Added:
avatar alikon
alikon - comment - 24 Jun 2015

tested renaming some of the table names involved and works as expected
mssql & postgresql

avatar zero-24 zero-24 - alter_testresult - 24 Jun 2015 - alikon: Tested successfully
avatar dgt41
dgt41 - comment - 26 Jun 2015

@test OK

avatar Bakual Bakual - change - 26 Jun 2015
Labels Added: ?
avatar zero-24 zero-24 - alter_testresult - 26 Jun 2015 - dgt41: Tested successfully
avatar zero-24 zero-24 - change - 26 Jun 2015
Status Pending Ready to Commit
avatar zero-24
zero-24 - comment - 26 Jun 2015

RTC Thanks :smile:


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7187.

avatar zero-24
zero-24 - comment - 26 Jun 2015

Ah we have already the label :+1:

avatar wilsonge wilsonge - reference | 262d527 - 27 Jun 15
avatar wilsonge wilsonge - merge - 27 Jun 2015
avatar wilsonge wilsonge - close - 27 Jun 2015
avatar wilsonge wilsonge - change - 27 Jun 2015
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2015-06-27 00:12:23
Closed_By wilsonge
avatar wilsonge wilsonge - close - 27 Jun 2015
avatar wilsonge
wilsonge - comment - 27 Jun 2015

Merged - thanks Thomas!

avatar Bakual Bakual - head_ref_deleted - 27 Jun 2015
avatar zero-24 zero-24 - change - 14 Oct 2015
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment