Skip to content
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

Closed
wants to merge 8 commits into from
Closed

improve logging levels #2278

wants to merge 8 commits into from

Conversation

crossan007
Copy link
Contributor

create a system config for sLogLevel that defies what severity events should be logged.

@ghost ghost assigned crossan007 Apr 9, 2017
@ghost ghost added the In Review label Apr 9, 2017
@crossan007 crossan007 requested a review from DawoudIO April 9, 2017 11:17
// **************************************************
$logFile = SystemConfig::getValue("sLogFile");
if (SystemConfig::getBooleanValue("debug")) {
if (intval(SystemConfig::getValue("sLogLevel")) == 100) {
Copy link
Contributor

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why comment these

Copy link
Contributor Author

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));
Copy link
Contributor

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

Copy link
Contributor Author

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?

@crossan007
Copy link
Contributor Author

Do you think we could store log info in the config. Php? Still edit in the UI though...

@crossan007
Copy link
Contributor Author

That way logging isn't dependant on the database.

@crossan007
Copy link
Contributor Author

The system should still be able to write logs even if the database connecting fails

Copy link
Contributor

@DawoudIO DawoudIO left a 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

@crossan007
Copy link
Contributor Author

Superseded by #2424

@crossan007 crossan007 closed this Apr 30, 2017
@ghost ghost removed the In Review label Apr 30, 2017
DawoudIO pushed a commit that referenced this pull request May 3, 2017
* 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
@DawoudIO DawoudIO deleted the feature/better-errors branch July 1, 2017 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants