-
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
improve logging levels #2278
improve logging levels #2278
Conversation
Apply fixes from StyleCI
// ************************************************** | ||
$logFile = SystemConfig::getValue("sLogFile"); | ||
if (SystemConfig::getBooleanValue("debug")) { | ||
if (intval(SystemConfig::getValue("sLogLevel")) == 100) { |
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.
No magic numbers do use the same object
$logger = new Logger('defaultLogger'); | ||
$logger->pushHandler(new StreamHandler($logFile, intval(SystemConfig::getValue("sLogLevel")))); | ||
$serviceContainer->setLogger('defaultLogger', $logger); | ||
#ini_set('log_errors', 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.
Why comment these
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.
My thought here is that the PHP error handler is going to write to the logs in a different format than MonoLogger. This will maker parsing (maybe with ELK) more difficult.
We could configure Monologger to handle all PHP errors: Seldaek/monolog#199
@DawoudIO thoughts?
} | ||
$manager->setConfiguration(buildConnectionManagerConfig($sSERVERNAME, $sDATABASE, $sUSER, $sPASSWORD, $dbClassName)); |
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.
The db class Name is set about so that we can init the system configuration... I fought with this for an hour to get the correct order
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.
I'm still not sure I understand what's going on here 100%..... Am I introducing a "chicken and the egg" problem by relying on a DB query before the DB is initialized?
Do you think we could store log info in the config. Php? Still edit in the UI though... |
That way logging isn't dependant on the database. |
The system should still be able to write logs even if the database connecting fails |
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.
see notes for needed changes
Superseded by #2424 |
* log ver * removed sLogFile setting and updated debug to false by default * $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 * new dir for logs but no access from the web * Split logs into 3 - ORM - APP - PHP * always log PHP and APP Logs * NullHandler is no longer used * fixed typo * added "sLogLevel" from #2278 * log ver (#2416) * added hasValidMailServerSettings * using logLevel to enable logs for ORM based on level * fixed hint for Debug and sLogLevel * removed debug and using sLogLevel * finish rev * enabled sEnableGravatarPhotos (#2427) * closes #2432 (#2435) * fix directory date localization (#2444) * exclude logs in the system files * Update BaseEmail.php updated to false * moved delete into ORM as a pre-delete hook * delete people for a family is now done via orm * import cleanup * fixed delete issues * re-order and better ORM delete
create a system config for sLogLevel that defies what severity events should be logged.