From 8111cfbac20e574e8e0213b54bf81b5cec8b5e72 Mon Sep 17 00:00:00 2001 From: George Dawoud Date: Sat, 29 Apr 2017 16:24:18 -0700 Subject: [PATCH 01/11] removed sLogFile setting and updated debug to false by default --- src/ChurchCRM/dto/SystemConfig.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ChurchCRM/dto/SystemConfig.php b/src/ChurchCRM/dto/SystemConfig.php index a49984d8b6..b8ca4e7c92 100644 --- a/src/ChurchCRM/dto/SystemConfig.php +++ b/src/ChurchCRM/dto/SystemConfig.php @@ -49,8 +49,7 @@ private static function getSupportedLocales() private static function buildConfigs() { return array( - "debug" => new ConfigItem(2, "debug", "boolean", "1", gettext("Set debug mode\r\nThis may be helpful for when you're first setting up ChurchCRM, but you should\r\nprobably turn it off for maximum security otherwise. If you are having trouble,\r\nplease enable this so that you'll know what the errors are. This is especially\r\nimportant if you need to report a problem on the help forums.")), - "sLogFile" => new ConfigItem(3, "sLogFile", "text", "/tmp/ChurchCRM.log", gettext("If debug is enabled the location of log files.")), + "debug" => new ConfigItem(2, "debug", "boolean", "0", gettext("Set debug mode\r\nThis may be helpful for when you're first setting up ChurchCRM, but you should\r\nprobably turn it off for maximum security otherwise. If you are having trouble,\r\nplease enable this so that you'll know what the errors are. This is especially\r\nimportant if you need to report a problem on the help forums.")), "sDirClassifications" => new ConfigItem(5, "sDirClassifications", "text", "1,2,4,5", gettext("Include only these classifications in the directory, comma seperated")), "sDirRoleHead" => new ConfigItem(6, "sDirRoleHead", "text", "1", gettext("These are the family role numbers designated as head of house")), "sDirRoleSpouse" => new ConfigItem(7, "sDirRoleSpouse", "text", "2", gettext("These are the family role numbers designated as spouse")), @@ -179,7 +178,7 @@ private static function buildCategories() gettext('User setup') => ["sMinPasswordLength","sMinPasswordChange","iMaxFailedLogins","sSessionTimeout","sDisallowedPasswords"], gettext('Email Setup') => ["sSMTPHost","sSMTPAuth","sSMTPUser","sSMTPPass", "iSMTPTimeout","sToEmailAddress","mailChimpApiKey"], gettext('Member Setup') => ["sDirClassifications","sDirRoleHead","sDirRoleSpouse","sDirRoleChild","sDefaultCity","sDefaultState","sDefaultCountry","bShowFamilyData","bHidePersonAddress","bHideFriendDate","bHideFamilyNewsletter","bHideWeddingDate","bHideLatLon","cfgForceUppercaseZip","sEnableGravatarPhotos","sEnableSelfRegistration", "bAllowEmptyLastName", "iPersonNameStyle"], - gettext('System Settings') => ["sLastBackupTimeStamp","sExternalBackupAutoInterval","sExternalBackupPassword","sEnableExternalBackupTarget","sExternalBackupType","sExternalBackupEndpoint","sExternalBackupUsername","debug","sLogFile", "bRegistered","sXML_RPC_PATH","sGZIPname","sZIPname","sPGPname","bCSVAdminOnly","sHeader","sEnableIntegrityCheck","sIntegrityCheckInterval","sLastIntegrityCheckTimeStamp"], + gettext('System Settings') => ["sLastBackupTimeStamp","sExternalBackupAutoInterval","sExternalBackupPassword","sEnableExternalBackupTarget","sExternalBackupType","sExternalBackupEndpoint","sExternalBackupUsername","debug", "bRegistered","sXML_RPC_PATH","sGZIPname","sZIPname","sPGPname","bCSVAdminOnly","sHeader","sEnableIntegrityCheck","sIntegrityCheckInterval","sLastIntegrityCheckTimeStamp"], gettext('Map Settings') => ["sGeoCoderProvider","sGoogleMapKey","sBingMapKey","sGMapIcons", "iMapZoom","sISTusername","sISTpassword","sGeocoderID","sGeocoderPW"], gettext('Report Settings') => ["sQBDTSettings","leftX","incrementY","sTaxReport1","sTaxReport2","sTaxReport3","sTaxSigner","sReminder1","sReminderSigner","sReminderNoPledge","sReminderNoPayments","sConfirm1","sConfirm2","sConfirm3","sConfirm4","sConfirm5","sConfirm6","sDear","sConfirmSincerely","sConfirmSigner","sPledgeSummary1","sPledgeSummary2","sDirectoryDisclaimer1","sDirectoryDisclaimer2","bDirLetterHead","sZeroGivers","sZeroGivers2","sZeroGivers3"], gettext('Localization') => ["sLanguage","sDistanceUnit","sPhoneFormat","sPhoneFormatWithExt","sDateFormatLong","sDateFormatNoYear","sDateFormatShort","sDateTimeFormat","sDateFilenameFormat"], From 8ab1093ab975f0cd4cb48e3c4134d31473744e91 Mon Sep 17 00:00:00 2001 From: George Dawoud Date: Sat, 29 Apr 2017 16:24:49 -0700 Subject: [PATCH 02/11] $logger is now alway set - if debug is on - then use file logger to a local file - if debug is off - then use a null handler --- src/Include/LoadConfigs.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Include/LoadConfigs.php b/src/Include/LoadConfigs.php index 1112c6b1fa..998ffc6c2a 100644 --- a/src/Include/LoadConfigs.php +++ b/src/Include/LoadConfigs.php @@ -44,6 +44,7 @@ use Monolog\Logger; use Propel\Runtime\Connection\ConnectionManagerSingle; use Propel\Runtime\Propel; +use Monolog\Handler\NullHandler; function system_failure($message, $header = 'Setup failure') { @@ -134,15 +135,18 @@ function buildConnectionManagerConfig($sSERVERNAME, $sDATABASE, $sUSER, $sPASSWO // enable logs if we are in debug mode // ************************************************** -$logFile = SystemConfig::getValue("sLogFile"); + +$logger = new Logger('defaultLogger'); if (SystemConfig::getBooleanValue("debug")) { + $logFile = SystemURLs::getDocumentRoot().'/logs/ChurchCRM-'.date("Y-m-d").'.log'; $dbClassName = "\\Propel\\Runtime\\Connection\\DebugPDO"; $manager->setConfiguration(buildConnectionManagerConfig($sSERVERNAME, $sDATABASE, $sUSER, $sPASSWORD, $dbClassName)); - $logger = new Logger('defaultLogger'); $logger->pushHandler(new StreamHandler($logFile)); $serviceContainer->setLogger('defaultLogger', $logger); ini_set('log_errors', 1); ini_set('error_log', $logFile); +} else { + $logger->pushHandler(new NullHandler()); } if (isset($_SESSION['iUserID'])) { // Not set on Login.php From 12201e1fede49201730b264c132762ad23f676cb Mon Sep 17 00:00:00 2001 From: George Dawoud Date: Sat, 29 Apr 2017 16:25:04 -0700 Subject: [PATCH 03/11] new dir for logs but no access from the web --- .gitignore | 1 + src/logs/.htaccess | 1 + 2 files changed, 2 insertions(+) create mode 100644 src/logs/.htaccess diff --git a/.gitignore b/.gitignore index 29c545e64b..fee11a0148 100644 --- a/.gitignore +++ b/.gitignore @@ -51,3 +51,4 @@ src/ChurchCRM/model/ChurchCRM/Map src/signatures.json src/integrityCheck.json src/tmp_attach +src/logs/*.log diff --git a/src/logs/.htaccess b/src/logs/.htaccess new file mode 100644 index 0000000000..8d2f25636d --- /dev/null +++ b/src/logs/.htaccess @@ -0,0 +1 @@ +deny from all From 5372926b8252d8427ed4c30c04e9f2776636f1c2 Mon Sep 17 00:00:00 2001 From: George Dawoud Date: Sat, 29 Apr 2017 16:37:28 -0700 Subject: [PATCH 04/11] Split logs into 3 - ORM - APP - PHP --- src/Include/LoadConfigs.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Include/LoadConfigs.php b/src/Include/LoadConfigs.php index 998ffc6c2a..4b96690091 100644 --- a/src/Include/LoadConfigs.php +++ b/src/Include/LoadConfigs.php @@ -137,17 +137,20 @@ function buildConnectionManagerConfig($sSERVERNAME, $sDATABASE, $sUSER, $sPASSWO // ************************************************** $logger = new Logger('defaultLogger'); +$logFilePrefix = SystemURLs::getDocumentRoot().'/logs/'.date("Y-m-d"); if (SystemConfig::getBooleanValue("debug")) { - $logFile = SystemURLs::getDocumentRoot().'/logs/ChurchCRM-'.date("Y-m-d").'.log'; + $logger->pushHandler(new StreamHandler($logFilePrefix.'-app.log')); + + $ormLogger = new Logger('ormLogger'); $dbClassName = "\\Propel\\Runtime\\Connection\\DebugPDO"; $manager->setConfiguration(buildConnectionManagerConfig($sSERVERNAME, $sDATABASE, $sUSER, $sPASSWORD, $dbClassName)); - $logger->pushHandler(new StreamHandler($logFile)); - $serviceContainer->setLogger('defaultLogger', $logger); - ini_set('log_errors', 1); - ini_set('error_log', $logFile); + $ormLogger->pushHandler(new StreamHandler($logFilePrefix.'-orm.log')); + $serviceContainer->setLogger('defaultLogger', $ormLogger); } else { $logger->pushHandler(new NullHandler()); } +ini_set('log_errors', 1); +ini_set('error_log', $logFilePrefix.'-php.log'); if (isset($_SESSION['iUserID'])) { // Not set on Login.php // Load user variables from user config table. From 9897474afbf9b544368ea8e6c1103f58141ec6a7 Mon Sep 17 00:00:00 2001 From: George Dawoud Date: Sat, 29 Apr 2017 16:39:58 -0700 Subject: [PATCH 05/11] always log PHP and APP Logs --- src/Include/LoadConfigs.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Include/LoadConfigs.php b/src/Include/LoadConfigs.php index 4b96690091..351aa102c1 100644 --- a/src/Include/LoadConfigs.php +++ b/src/Include/LoadConfigs.php @@ -136,21 +136,25 @@ function buildConnectionManagerConfig($sSERVERNAME, $sDATABASE, $sUSER, $sPASSWO // enable logs if we are in debug mode // ************************************************** -$logger = new Logger('defaultLogger'); $logFilePrefix = SystemURLs::getDocumentRoot().'/logs/'.date("Y-m-d"); -if (SystemConfig::getBooleanValue("debug")) { - $logger->pushHandler(new StreamHandler($logFilePrefix.'-app.log')); +// PHP Logs +ini_set('log_errors', 1); +ini_set('error_log', $logFilePrefix.'-php.log'); + +// APP Logs +$logger = new Logger('defaultLogger'); +$logger->pushHandler(new StreamHandler($logFilePrefix.'-app.log')); + +if (SystemConfig::getBooleanValue("debug")) { + // ORM Logs $ormLogger = new Logger('ormLogger'); $dbClassName = "\\Propel\\Runtime\\Connection\\DebugPDO"; $manager->setConfiguration(buildConnectionManagerConfig($sSERVERNAME, $sDATABASE, $sUSER, $sPASSWORD, $dbClassName)); $ormLogger->pushHandler(new StreamHandler($logFilePrefix.'-orm.log')); $serviceContainer->setLogger('defaultLogger', $ormLogger); -} else { - $logger->pushHandler(new NullHandler()); } -ini_set('log_errors', 1); -ini_set('error_log', $logFilePrefix.'-php.log'); + if (isset($_SESSION['iUserID'])) { // Not set on Login.php // Load user variables from user config table. From f027179a5f8480ce857e44f2cbcdea8ad116609d Mon Sep 17 00:00:00 2001 From: George Dawoud Date: Sat, 29 Apr 2017 16:42:46 -0700 Subject: [PATCH 06/11] NullHandler is no longer used --- src/ChurchCRM/dto/SystemConfig.php | 2 +- src/Include/LoadConfigs.php | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ChurchCRM/dto/SystemConfig.php b/src/ChurchCRM/dto/SystemConfig.php index b8ca4e7c92..271185366d 100644 --- a/src/ChurchCRM/dto/SystemConfig.php +++ b/src/ChurchCRM/dto/SystemConfig.php @@ -49,7 +49,7 @@ private static function getSupportedLocales() private static function buildConfigs() { return array( - "debug" => new ConfigItem(2, "debug", "boolean", "0", gettext("Set debug mode\r\nThis may be helpful for when you're first setting up ChurchCRM, but you should\r\nprobably turn it off for maximum security otherwise. If you are having trouble,\r\nplease enable this so that you'll know what the errors are. This is especially\r\nimportant if you need to report a problem on the help forums.")), + "debug" => new ConfigItem(2, "debug", "boolean", "0", gettext("Set debug mode for dbl logs.")), "sDirClassifications" => new ConfigItem(5, "sDirClassifications", "text", "1,2,4,5", gettext("Include only these classifications in the directory, comma seperated")), "sDirRoleHead" => new ConfigItem(6, "sDirRoleHead", "text", "1", gettext("These are the family role numbers designated as head of house")), "sDirRoleSpouse" => new ConfigItem(7, "sDirRoleSpouse", "text", "2", gettext("These are the family role numbers designated as spouse")), diff --git a/src/Include/LoadConfigs.php b/src/Include/LoadConfigs.php index 351aa102c1..d37541f53c 100644 --- a/src/Include/LoadConfigs.php +++ b/src/Include/LoadConfigs.php @@ -44,7 +44,6 @@ use Monolog\Logger; use Propel\Runtime\Connection\ConnectionManagerSingle; use Propel\Runtime\Propel; -use Monolog\Handler\NullHandler; function system_failure($message, $header = 'Setup failure') { From d46efa69ff9fd1414dc824254f3270e97c48b301 Mon Sep 17 00:00:00 2001 From: George Dawoud Date: Sat, 29 Apr 2017 16:43:52 -0700 Subject: [PATCH 07/11] fixed typo --- src/ChurchCRM/dto/SystemConfig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ChurchCRM/dto/SystemConfig.php b/src/ChurchCRM/dto/SystemConfig.php index 271185366d..76f06129b5 100644 --- a/src/ChurchCRM/dto/SystemConfig.php +++ b/src/ChurchCRM/dto/SystemConfig.php @@ -49,7 +49,7 @@ private static function getSupportedLocales() private static function buildConfigs() { return array( - "debug" => new ConfigItem(2, "debug", "boolean", "0", gettext("Set debug mode for dbl logs.")), + "debug" => new ConfigItem(2, "debug", "boolean", "0", gettext("Set debug mode for ORM logs")), "sDirClassifications" => new ConfigItem(5, "sDirClassifications", "text", "1,2,4,5", gettext("Include only these classifications in the directory, comma seperated")), "sDirRoleHead" => new ConfigItem(6, "sDirRoleHead", "text", "1", gettext("These are the family role numbers designated as head of house")), "sDirRoleSpouse" => new ConfigItem(7, "sDirRoleSpouse", "text", "2", gettext("These are the family role numbers designated as spouse")), From 886124ce36bf5903235843ed3fe3f0071ce9886c Mon Sep 17 00:00:00 2001 From: George Dawoud Date: Sat, 29 Apr 2017 16:52:40 -0700 Subject: [PATCH 08/11] added "sLogLevel" from #2278 --- src/ChurchCRM/dto/SystemConfig.php | 19 ++++++++++++++++++- src/Include/LoadConfigs.php | 4 ++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/ChurchCRM/dto/SystemConfig.php b/src/ChurchCRM/dto/SystemConfig.php index 76f06129b5..b9df725e06 100644 --- a/src/ChurchCRM/dto/SystemConfig.php +++ b/src/ChurchCRM/dto/SystemConfig.php @@ -46,10 +46,27 @@ private static function getSupportedLocales() } + public static function getMonoLogLevels() + { + return [ + "Choices" => [ + gettext("DEBUG").":100", + gettext("INFO").":200", + gettext("NOTICE").":250", + gettext("WARNING").":300", + gettext("ERROR").":400", + gettext("CRITICAL").":500", + gettext("ALERT").":550", + gettext("EMERGENCY").":600" + ] + ]; + } + private static function buildConfigs() { return array( "debug" => new ConfigItem(2, "debug", "boolean", "0", gettext("Set debug mode for ORM logs")), + "sLogLevel" => new ConfigItem(4, "sLogLevel", "choice", "200", gettext("Event Log severity to write"), json_encode(SystemConfig::getMonoLogLevels())), "sDirClassifications" => new ConfigItem(5, "sDirClassifications", "text", "1,2,4,5", gettext("Include only these classifications in the directory, comma seperated")), "sDirRoleHead" => new ConfigItem(6, "sDirRoleHead", "text", "1", gettext("These are the family role numbers designated as head of house")), "sDirRoleSpouse" => new ConfigItem(7, "sDirRoleSpouse", "text", "2", gettext("These are the family role numbers designated as spouse")), @@ -178,7 +195,7 @@ private static function buildCategories() gettext('User setup') => ["sMinPasswordLength","sMinPasswordChange","iMaxFailedLogins","sSessionTimeout","sDisallowedPasswords"], gettext('Email Setup') => ["sSMTPHost","sSMTPAuth","sSMTPUser","sSMTPPass", "iSMTPTimeout","sToEmailAddress","mailChimpApiKey"], gettext('Member Setup') => ["sDirClassifications","sDirRoleHead","sDirRoleSpouse","sDirRoleChild","sDefaultCity","sDefaultState","sDefaultCountry","bShowFamilyData","bHidePersonAddress","bHideFriendDate","bHideFamilyNewsletter","bHideWeddingDate","bHideLatLon","cfgForceUppercaseZip","sEnableGravatarPhotos","sEnableSelfRegistration", "bAllowEmptyLastName", "iPersonNameStyle"], - gettext('System Settings') => ["sLastBackupTimeStamp","sExternalBackupAutoInterval","sExternalBackupPassword","sEnableExternalBackupTarget","sExternalBackupType","sExternalBackupEndpoint","sExternalBackupUsername","debug", "bRegistered","sXML_RPC_PATH","sGZIPname","sZIPname","sPGPname","bCSVAdminOnly","sHeader","sEnableIntegrityCheck","sIntegrityCheckInterval","sLastIntegrityCheckTimeStamp"], + gettext('System Settings') => ["sLastBackupTimeStamp","sExternalBackupAutoInterval","sExternalBackupPassword","sEnableExternalBackupTarget","sExternalBackupType","sExternalBackupEndpoint","sExternalBackupUsername","debug","sLogLevel", "bRegistered","sXML_RPC_PATH","sGZIPname","sZIPname","sPGPname","bCSVAdminOnly","sHeader","sEnableIntegrityCheck","sIntegrityCheckInterval","sLastIntegrityCheckTimeStamp"], gettext('Map Settings') => ["sGeoCoderProvider","sGoogleMapKey","sBingMapKey","sGMapIcons", "iMapZoom","sISTusername","sISTpassword","sGeocoderID","sGeocoderPW"], gettext('Report Settings') => ["sQBDTSettings","leftX","incrementY","sTaxReport1","sTaxReport2","sTaxReport3","sTaxSigner","sReminder1","sReminderSigner","sReminderNoPledge","sReminderNoPayments","sConfirm1","sConfirm2","sConfirm3","sConfirm4","sConfirm5","sConfirm6","sDear","sConfirmSincerely","sConfirmSigner","sPledgeSummary1","sPledgeSummary2","sDirectoryDisclaimer1","sDirectoryDisclaimer2","bDirLetterHead","sZeroGivers","sZeroGivers2","sZeroGivers3"], gettext('Localization') => ["sLanguage","sDistanceUnit","sPhoneFormat","sPhoneFormatWithExt","sDateFormatLong","sDateFormatNoYear","sDateFormatShort","sDateTimeFormat","sDateFilenameFormat"], diff --git a/src/Include/LoadConfigs.php b/src/Include/LoadConfigs.php index d37541f53c..12a2807395 100644 --- a/src/Include/LoadConfigs.php +++ b/src/Include/LoadConfigs.php @@ -143,14 +143,14 @@ function buildConnectionManagerConfig($sSERVERNAME, $sDATABASE, $sUSER, $sPASSWO // APP Logs $logger = new Logger('defaultLogger'); -$logger->pushHandler(new StreamHandler($logFilePrefix.'-app.log')); +$logger->pushHandler(new StreamHandler($logFilePrefix.'-app.log', intval(SystemConfig::getValue("sLogLevel")))); if (SystemConfig::getBooleanValue("debug")) { // ORM Logs $ormLogger = new Logger('ormLogger'); $dbClassName = "\\Propel\\Runtime\\Connection\\DebugPDO"; $manager->setConfiguration(buildConnectionManagerConfig($sSERVERNAME, $sDATABASE, $sUSER, $sPASSWORD, $dbClassName)); - $ormLogger->pushHandler(new StreamHandler($logFilePrefix.'-orm.log')); + $ormLogger->pushHandler(new StreamHandler($logFilePrefix.'-orm.log', intval(SystemConfig::getValue("sLogLevel")))); $serviceContainer->setLogger('defaultLogger', $ormLogger); } From 224af95e3ed4d5045f8c4f23afc3dfd76863e5fb Mon Sep 17 00:00:00 2001 From: George Dawoud Date: Sat, 29 Apr 2017 17:53:24 -0700 Subject: [PATCH 09/11] using logLevel to enable logs for ORM based on level --- src/Include/LoadConfigs.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Include/LoadConfigs.php b/src/Include/LoadConfigs.php index 12a2807395..a34b52259c 100644 --- a/src/Include/LoadConfigs.php +++ b/src/Include/LoadConfigs.php @@ -136,6 +136,7 @@ function buildConnectionManagerConfig($sSERVERNAME, $sDATABASE, $sUSER, $sPASSWO // ************************************************** $logFilePrefix = SystemURLs::getDocumentRoot().'/logs/'.date("Y-m-d"); +$logLevel = intval(SystemConfig::getValue("sLogLevel")); // PHP Logs ini_set('log_errors', 1); @@ -143,16 +144,14 @@ function buildConnectionManagerConfig($sSERVERNAME, $sDATABASE, $sUSER, $sPASSWO // APP Logs $logger = new Logger('defaultLogger'); -$logger->pushHandler(new StreamHandler($logFilePrefix.'-app.log', intval(SystemConfig::getValue("sLogLevel")))); - -if (SystemConfig::getBooleanValue("debug")) { - // ORM Logs - $ormLogger = new Logger('ormLogger'); - $dbClassName = "\\Propel\\Runtime\\Connection\\DebugPDO"; - $manager->setConfiguration(buildConnectionManagerConfig($sSERVERNAME, $sDATABASE, $sUSER, $sPASSWORD, $dbClassName)); - $ormLogger->pushHandler(new StreamHandler($logFilePrefix.'-orm.log', intval(SystemConfig::getValue("sLogLevel")))); - $serviceContainer->setLogger('defaultLogger', $ormLogger); -} +$logger->pushHandler(new StreamHandler($logFilePrefix.'-app.log', $logLevel)); + +// ORM Logs +$ormLogger = new Logger('ormLogger'); +$dbClassName = "\\Propel\\Runtime\\Connection\\DebugPDO"; +$manager->setConfiguration(buildConnectionManagerConfig($sSERVERNAME, $sDATABASE, $sUSER, $sPASSWORD, $dbClassName)); +$ormLogger->pushHandler(new StreamHandler($logFilePrefix.'-orm.log', $logLevel)); +$serviceContainer->setLogger('defaultLogger', $ormLogger); if (isset($_SESSION['iUserID'])) { // Not set on Login.php From 90e3e3dd00bad2387b46364407a68f91f6a43acc Mon Sep 17 00:00:00 2001 From: George Dawoud Date: Sat, 29 Apr 2017 17:54:45 -0700 Subject: [PATCH 10/11] fixed hint for Debug and sLogLevel --- src/ChurchCRM/dto/SystemConfig.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ChurchCRM/dto/SystemConfig.php b/src/ChurchCRM/dto/SystemConfig.php index b9df725e06..d3bbeb4a1d 100644 --- a/src/ChurchCRM/dto/SystemConfig.php +++ b/src/ChurchCRM/dto/SystemConfig.php @@ -65,8 +65,8 @@ public static function getMonoLogLevels() private static function buildConfigs() { return array( - "debug" => new ConfigItem(2, "debug", "boolean", "0", gettext("Set debug mode for ORM logs")), - "sLogLevel" => new ConfigItem(4, "sLogLevel", "choice", "200", gettext("Event Log severity to write"), json_encode(SystemConfig::getMonoLogLevels())), + "debug" => new ConfigItem(2, "debug", "boolean", "0", gettext("Set debug mode for sql errors, note ORM logs are controlled by sLogLevel")), + "sLogLevel" => new ConfigItem(4, "sLogLevel", "choice", "200", gettext("Event Log severity to write, used by ORM and App Logs"), json_encode(SystemConfig::getMonoLogLevels())), "sDirClassifications" => new ConfigItem(5, "sDirClassifications", "text", "1,2,4,5", gettext("Include only these classifications in the directory, comma seperated")), "sDirRoleHead" => new ConfigItem(6, "sDirRoleHead", "text", "1", gettext("These are the family role numbers designated as head of house")), "sDirRoleSpouse" => new ConfigItem(7, "sDirRoleSpouse", "text", "2", gettext("These are the family role numbers designated as spouse")), From ba1bc19fed27336a104f679bc03c15279ff6e3e7 Mon Sep 17 00:00:00 2001 From: George Dawoud Date: Sat, 29 Apr 2017 18:01:12 -0700 Subject: [PATCH 11/11] removed debug and using sLogLevel --- src/ChurchCRM/dto/SystemConfig.php | 3 +-- src/Include/Functions.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ChurchCRM/dto/SystemConfig.php b/src/ChurchCRM/dto/SystemConfig.php index d3bbeb4a1d..e57236c598 100644 --- a/src/ChurchCRM/dto/SystemConfig.php +++ b/src/ChurchCRM/dto/SystemConfig.php @@ -65,7 +65,6 @@ public static function getMonoLogLevels() private static function buildConfigs() { return array( - "debug" => new ConfigItem(2, "debug", "boolean", "0", gettext("Set debug mode for sql errors, note ORM logs are controlled by sLogLevel")), "sLogLevel" => new ConfigItem(4, "sLogLevel", "choice", "200", gettext("Event Log severity to write, used by ORM and App Logs"), json_encode(SystemConfig::getMonoLogLevels())), "sDirClassifications" => new ConfigItem(5, "sDirClassifications", "text", "1,2,4,5", gettext("Include only these classifications in the directory, comma seperated")), "sDirRoleHead" => new ConfigItem(6, "sDirRoleHead", "text", "1", gettext("These are the family role numbers designated as head of house")), @@ -195,7 +194,7 @@ private static function buildCategories() gettext('User setup') => ["sMinPasswordLength","sMinPasswordChange","iMaxFailedLogins","sSessionTimeout","sDisallowedPasswords"], gettext('Email Setup') => ["sSMTPHost","sSMTPAuth","sSMTPUser","sSMTPPass", "iSMTPTimeout","sToEmailAddress","mailChimpApiKey"], gettext('Member Setup') => ["sDirClassifications","sDirRoleHead","sDirRoleSpouse","sDirRoleChild","sDefaultCity","sDefaultState","sDefaultCountry","bShowFamilyData","bHidePersonAddress","bHideFriendDate","bHideFamilyNewsletter","bHideWeddingDate","bHideLatLon","cfgForceUppercaseZip","sEnableGravatarPhotos","sEnableSelfRegistration", "bAllowEmptyLastName", "iPersonNameStyle"], - gettext('System Settings') => ["sLastBackupTimeStamp","sExternalBackupAutoInterval","sExternalBackupPassword","sEnableExternalBackupTarget","sExternalBackupType","sExternalBackupEndpoint","sExternalBackupUsername","debug","sLogLevel", "bRegistered","sXML_RPC_PATH","sGZIPname","sZIPname","sPGPname","bCSVAdminOnly","sHeader","sEnableIntegrityCheck","sIntegrityCheckInterval","sLastIntegrityCheckTimeStamp"], + gettext('System Settings') => ["sLastBackupTimeStamp","sExternalBackupAutoInterval","sExternalBackupPassword","sEnableExternalBackupTarget","sExternalBackupType","sExternalBackupEndpoint","sExternalBackupUsername","sLogLevel", "bRegistered","sXML_RPC_PATH","sGZIPname","sZIPname","sPGPname","bCSVAdminOnly","sHeader","sEnableIntegrityCheck","sIntegrityCheckInterval","sLastIntegrityCheckTimeStamp"], gettext('Map Settings') => ["sGeoCoderProvider","sGoogleMapKey","sBingMapKey","sGMapIcons", "iMapZoom","sISTusername","sISTpassword","sGeocoderID","sGeocoderPW"], gettext('Report Settings') => ["sQBDTSettings","leftX","incrementY","sTaxReport1","sTaxReport2","sTaxReport3","sTaxSigner","sReminder1","sReminderSigner","sReminderNoPledge","sReminderNoPayments","sConfirm1","sConfirm2","sConfirm3","sConfirm4","sConfirm5","sConfirm6","sDear","sConfirmSincerely","sConfirmSigner","sPledgeSummary1","sPledgeSummary2","sDirectoryDisclaimer1","sDirectoryDisclaimer2","bDirLetterHead","sZeroGivers","sZeroGivers2","sZeroGivers3"], gettext('Localization') => ["sLanguage","sDistanceUnit","sPhoneFormat","sPhoneFormatWithExt","sDateFormatLong","sDateFormatNoYear","sDateFormatShort","sDateTimeFormat","sDateFilenameFormat"], diff --git a/src/Include/Functions.php b/src/Include/Functions.php index a252c010b9..e843754032 100644 --- a/src/Include/Functions.php +++ b/src/Include/Functions.php @@ -289,7 +289,7 @@ function RunQuery($sSQL, $bStopOnError = true) if ($result = mysqli_query($cnInfoCentral, $sSQL)) { return $result; } elseif ($bStopOnError) { - if (SystemConfig::getValue('debug')) { + if (SystemConfig::getValue('sLogLevel ') == "100") { // debug level die(gettext('Cannot execute query.')."

$sSQL

".mysqli_error()); } else { die('Database error or invalid data');