-
Notifications
You must be signed in to change notification settings - Fork 443
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
System Logs v2 #2424
System Logs v2 #2424
Changes from all commits
8111cfb
8ab1093
12201e1
5372926
9897474
f027179
d46efa6
886124c
224af95
90e3e3d
ba1bc19
21ab3d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,3 +51,4 @@ src/ChurchCRM/model/ChurchCRM/Map | |
src/signatures.json | ||
src/integrityCheck.json | ||
src/tmp_attach | ||
src/logs/*.log |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,16 +134,25 @@ function buildConnectionManagerConfig($sSERVERNAME, $sDATABASE, $sUSER, $sPASSWO | |
|
||
// enable logs if we are in debug mode | ||
// ************************************************** | ||
$logFile = SystemConfig::getValue("sLogFile"); | ||
if (SystemConfig::getBooleanValue("debug")) { | ||
$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); | ||
} | ||
|
||
$logFilePrefix = SystemURLs::getDocumentRoot().'/logs/'.date("Y-m-d"); | ||
$logLevel = intval(SystemConfig::getValue("sLogLevel")); | ||
|
||
// 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', $logLevel)); | ||
|
||
// ORM Logs | ||
$ormLogger = new Logger('ormLogger'); | ||
$dbClassName = "\\Propel\\Runtime\\Connection\\DebugPDO"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need a conditional here: https://github.com/ChurchCRM/CRM/pull/2278/files#diff-e9848400293ecb36fea0aef7708d40f5R138 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. http://propelorm.org/documentation/07-logging.html
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. again please open an issue to track, the goal was not to crash the system There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
$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 | ||
// Load user variables from user config table. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
deny from all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe make this write to the log instead of
die()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, if DEBUG is set, all queries should be logged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm that is now outside MVP... the goal of this PR is to ensure we don't crash... please open a issue to track it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#2442