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

Print mysql errors in debug output. #8414

Merged
merged 3 commits into from Mar 20, 2018

Conversation

Projects
None yet
4 participants
@murrant
Member

murrant commented Mar 19, 2018

DO NOT DELETE THIS TEXT

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926

@murrant murrant referenced this pull request Mar 19, 2018

Closed

refactor: Output any MySQL errors that we come across #8424

1 of 1 task complete
@tracernz

This looks great. 👍

@@ -117,7 +117,9 @@ function dbQuery($sql, $parameters = array())
$mysql_error = mysqli_error($database_link);
if (isset($config['mysql_log_level']) && ((in_array($config['mysql_log_level'], array('INFO', 'ERROR')) && !preg_match('/Duplicate entry/', $mysql_error)) || in_array($config['mysql_log_level'], array('DEBUG')))) {
if (!empty($mysql_error)) {
logfile(date($config['dateformat']['compact']) . " MySQL Error: $mysql_error ($fullSql)");
$error_msg = "MySQL Error: $mysql_error ($fullSql)";
c_echo("%R$error_msg%n\n", $debug);

This comment has been minimized.

@laf

laf Mar 19, 2018

Member

Maybe drop the $debug? This is the kind of thing we want to see regardless of debug being enabled or not.

This comment has been minimized.

@murrant

murrant Mar 19, 2018

Member

I'm fine with always printing this. We'll get more reports of broken queries.

murrant and others added some commits Mar 19, 2018

@scrutinizer-notifier

This comment has been minimized.

scrutinizer-notifier commented Mar 20, 2018

The inspection completed: No new issues

@laf

laf approved these changes Mar 20, 2018

LGTM

@laf laf merged commit a9e31dc into librenms:master Mar 20, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details

@murrant murrant deleted the murrant:print_errors branch Mar 20, 2018

@lock lock bot locked as resolved and limited conversation to collaborators May 19, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.