Permalink
Browse files

Merge pull request #404 from AKSW/feature/LogEnableEntry

adds a new .ini entry to enable/disable the logger
  • Loading branch information...
white-gecko committed Jul 11, 2017
2 parents 73f9c29 + c00fcfd commit 146af8093c1bcbc708e4c123b6dc62fb18ecd66d
@@ -197,6 +197,10 @@ public function _initConfig()
$config->libraryUrlBase = $config->staticUrlBase
. $config->libraries->path;
//check if log.level has a valid integer as value
if (!((int)$config->log->level >= 0 && (int)$config->log->level <= 7)) {
$config->log->level = 0;
}
// define constants for development/debugging
if (isset($config->debug) && (boolean)$config->debug) {
// display errors
@@ -208,6 +212,7 @@ public function _initConfig()
}
// log everything
$config->log->enabled = true;
$config->log->level = 7;
}
@@ -323,7 +328,7 @@ public function _initLogger()
// initialize logger
$writer = null;
if (is_writable($config->log->path) && ((boolean)$config->log->level !== false)) {
if (is_writable($config->log->path) && ((boolean)$config->log->enabled == true)) {
$levelFilter = new Zend_Log_Filter_Priority((int)$config->log->level, '<=');
$logName = $config->log->path . 'ontowiki';
@@ -396,7 +396,7 @@ public function getCustomLogger($identifier = self::DEFAULT_LOG_IDENTIFIER)
}
// initialize logger
if (is_writable($config->log->path) && ((boolean)$config->log->level !== false)) {
if (is_writable($config->log->path) && ((boolean)$config->log->enabled == true)) {
$levelFilter = new Zend_Log_Filter_Priority((int)$config->log->level, '<=');
$writer = new Zend_Log_Writer_Stream($config->log->path . $identifier . '.log');
@@ -244,6 +244,7 @@ service.auth.allowGet = false
; 6: Informational - Informational messages
; 7: Debug - Debug messages
;
log.enabled = true
log.level = 4
log.path = "logs"
@@ -84,7 +84,8 @@ public function aboutAction()
),
'Logging' => array(
'Path' => rtrim($this->_config->log->path, '/') . $logWritable,
'Level' => (bool)$this->_config->log->level ? $this->_config->log->level : 'disabled'
'Status' => (bool)$this->_config->log->enabled ? 'enabled' : 'disabled',
'Level' => (int)$this->_config->log->level
)
);

0 comments on commit 146af80

Please sign in to comment.