public static function log_webservices_logevent() { $log = new \Innomatic\Logging\Logger(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/log/webservices.log'); $event_caller = $m->getParam(0); $event_string = $m->getParam(1); $event_type = $m->getParam(2); return new \Innomatic\Webservices\Xmlrpc\XmlRpcResp(new \Innomatic\Webservices\Xmlrpc\XmlRpcVal($log->logEvent($event_caller->scalarVal(), $event_string->scalarVal(), $event_type->scalarVal()))); }
public function eraseAccessLog() { $log = new \Innomatic\Logging\Logger($this->mAccessLog); $log->cleanLog(); return true; }
function action_cleanrootwebserviceslog($eventData) { global $gPageStatus, $gLocale; $tempLog = new \Innomatic\Logging\Logger(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/log/webservices.log'); if ($tempLog->cleanLog()) { $gPageStatus = $gLocale->getStr('logcleaned_status'); } else { $gPageStatus = $gLocale->getStr('lognotcleaned_status'); } }
function action_cleanmodlog($eventData) { global $gLocale, $gLocale, $gStatus; $tempLog = new \Innomatic\Logging\Logger(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/applications/' . $eventData['appid'] . '/application.log'); if ($tempLog->cleanLog()) { $gStatus = $gLocale->getStr('logcleaned_status'); } else { $gStatus = $gLocale->getStr('lognotcleaned_status'); } }
public function executeCleandataaccesslog($eventData) { $query = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->execute('SELECT domainid FROM domains WHERE id=' . $eventData['domainid']); $tempLog = new \Innomatic\Logging\Logger(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/domains/' . $query->getFields('domainid') . '/log/dataaccess.log'); if ($tempLog->cleanLog()) { $this->status = $this->localeCatalog->getStr('logcleaned_status'); } else { $this->status = $this->localeCatalog->getStr('lognotcleaned_status'); } $this->setChanged(); $this->notifyObservers('status'); }
public function logEvent($destinations, $context, $eventString, $eventType = \Innomatic\Logging\Logger::GENERIC, $die = false) { // Root // if (isset($destinations['root'])) { $tmp_log = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getLogger(); $tmp_log->logEvent($context, $eventString, $eventType); unset($tmp_log); } // Root db // if (isset($destinations['rootda'])) { $tmp_log = new \Innomatic\Logging\Logger(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/log/innomatic_root_db.log'); $tmp_log->logEvent($context, $eventString, $eventType); unset($tmp_log); } // Web services // if (isset($destinations['webservices'])) { $tmp_log = new \Innomatic\Logging\Logger(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/log/webservices.log'); $tmp_log->logEvent($context, $eventString, $eventType); unset($tmp_log); } // PHP // if (isset($destinations['php'])) { if (\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getState() != \Innomatic\Core\InnomaticContainer::STATE_SETUP) { $php_log = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/log/php.log'; } else { $php_log = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/log/innomatic.log'; } $tmp_log = new \Innomatic\Logging\Logger($php_log); $tmp_log->logEvent($context, $eventString, $eventType); unset($tmp_log); } // Application // if (isset($destinations['application']) and is_dir(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/applications/' . $this->mApplication)) { $tmp_log = new \Innomatic\Logging\Logger(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/applications/' . $this->mApplication . '/application.log'); $tmp_log->logEvent($context, $eventString, $eventType); unset($tmp_log); } // Tenant // if (isset($destinations['domain'])) { $tmp_log = new \Innomatic\Logging\Logger(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/domains/' . \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->domaindata['domainid'] . '/log/domain.log'); $tmp_log->logEvent($context, $eventString, $eventType); unset($tmp_log); } // Tenant dataaccess // if (isset($destinations['domainda'])) { $tmp_log = new \Innomatic\Logging\Logger(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/domains/' . \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->domaindata['domainid'] . '/logs/dataaccess.log'); $tmp_log->logEvent($context, $eventString, $eventType); unset($tmp_log); } if ($die) { \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->abort($eventString); } return true; }
public function CleanDomainsLogs() { $domains_query = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess()->execute('SELECT domainid ' . 'FROM domains'); while (!$domains_query->eof) { $da_log_file = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/domains/' . $domains_query->getFields('domainid') . '/log/dataaccess.log'; if (file_exists($da_log_file)) { if ($this->mCleanDomainsLogs) { $log = new \Innomatic\Logging\Logger($da_log_file); $log->Rotate(0); unlink($da_log_file); } elseif ($this->mRotateDomainsLogs) { $log = new \Innomatic\Logging\Logger($da_log_file); $log->Rotate(7); } } if (file_exists(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/domains/' . $domains_query->getFields('domainid') . '/log/domain.log')) { if ($this->mCleanDomainsLogs) { $log = new \Innomatic\Logging\Logger(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/domains/' . $domains_query->getFields('domainid') . '/log/domain.log'); $log->Rotate(0); unlink(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/domains/' . $domains_query->getFields('domainid') . '/log/domain.log'); } elseif ($this->mRotateDomainsLogs) { $log = new \Innomatic\Logging\Logger(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/domains/' . $domains_query->getFields('domainid') . '/log/domain.log'); $log->Rotate(7); } } $domains_query->moveNext(); } return true; }
public function errorHandler($errorType, $errorMessage, $errorFile, $errorLine, $errorContext) { $logError[E_ERROR]['log'] = true; $logError[E_ERROR]['die'] = true; $logError[E_WARNING]['log'] = false; $logError[E_WARNING]['die'] = false; $logError[E_PARSE]['log'] = true; $logError[E_PARSE]['die'] = false; $logError[E_NOTICE]['log'] = false; $logError[E_NOTICE]['die'] = false; $logError[E_CORE_ERROR]['log'] = true; $logError[E_CORE_ERROR]['die'] = true; $logError[E_CORE_WARNING]['log'] = false; $logError[E_CORE_WARNING]['die'] = false; $logError[E_COMPILE_ERROR]['log'] = true; $logError[E_COMPILE_ERROR]['die'] = true; $logError[E_COMPILE_WARNING]['log'] = false; $logError[E_COMPILE_WARNING]['die'] = false; $logError[E_USER_ERROR]['log'] = true; $logError[E_USER_ERROR]['die'] = true; $logError[E_USER_WARNING]['log'] = false; $logError[E_USER_WARNING]['die'] = false; $logError[E_USER_NOTICE]['log'] = false; $logError[E_USER_NOTICE]['die'] = false; if ($this->getState() != \Innomatic\Core\InnomaticContainer::STATE_SETUP) { $phpLog = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/log/php.log'; } else { $phpLog = \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getHome() . 'core/log/innomatic.log'; } switch ($this->state) { case \Innomatic\Core\InnomaticContainer::STATE_DEBUG: $logError[E_NOTICE]['log'] = true; $logError[E_USER_NOTICE]['log'] = true; $logError[E_WARNING]['log'] = true; $logError[E_CORE_WARNING]['log'] = true; $logError[E_COMPILE_WARNING]['die'] = true; $logError[E_USER_WARNING]['log'] = true; break; case \Innomatic\Core\InnomaticContainer::STATE_SETUP: /* For debug purposes in setup procedure add these commands: $log_err[E_NOTICE]['log'] = true; $log_err[E_USER_NOTICE]['log'] = true; */ $logError[E_WARNING]['log'] = true; $logError[E_CORE_WARNING]['log'] = true; $logError[E_COMPILE_WARNING]['die'] = true; $logError[E_USER_WARNING]['log'] = true; break; case \Innomatic\Core\InnomaticContainer::STATE_PRODUCTION: case \Innomatic\Core\InnomaticContainer::STATE_UPGRADE: break; } switch ($errorType) { case E_ERROR: if ($logError[E_ERROR]['log']) { $log = new \Innomatic\Logging\Logger($phpLog); $log->logEvent('Innomatic error handler', 'PHP generated an ERROR at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage, \Innomatic\Logging\Logger::FAILURE); } if ($logError[E_ERROR]['die']) { $this->abort('A fatal error occured at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage); } break; case E_WARNING: if ($logError[E_WARNING]['log']) { $log = new \Innomatic\Logging\Logger($phpLog); $log->logEvent('Innomatic error handler', 'PHP generated a WARNING at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage, \Innomatic\Logging\Logger::WARNING); } if ($logError[E_WARNING]['die']) { $this->abort('A warning occured at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage); } break; case E_PARSE: if ($logError[E_PARSE]['log']) { $log = new \Innomatic\Logging\Logger($phpLog); $log->logEvent('Innomatic error handler', 'PHP generated a PARSE error at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage, \Innomatic\Logging\Logger::ERROR); } if ($logError[E_PARSE]['die']) { $this->abort('A parse error occured at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage); } break; case E_NOTICE: if ($logError[E_NOTICE]['log']) { $log = new \Innomatic\Logging\Logger($phpLog); $log->logEvent('Innomatic error handler', 'PHP generated a notice at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage, \Innomatic\Logging\Logger::NOTICE); } if ($logError[E_NOTICE]['die']) { $this->abort('A notice occured at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage); } break; case E_CORE_ERROR: if ($logError[E_CORE_ERROR]['log']) { $log = new \Innomatic\Logging\Logger($phpLog); $log->logEvent('Innomatic error handler', 'PHP generated a CORE ERROR at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage, \Innomatic\Logging\Logger::ERROR); } if ($logError[E_CORE_ERROR]['die']) { $this->abort('A core error occured at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage); } break; case E_CORE_WARNING: if ($logError[E_CORE_WARNING]['log']) { $log = new \Innomatic\Logging\Logger($phpLog); $log->logEvent('Innomatic error handler', 'PHP generated a CORE WARNING at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage, \Innomatic\Logging\Logger::ERROR); } if ($logError[E_CORE_WARNING]['die']) { $this->abort('A core warning occured at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage); } break; case E_COMPILE_ERROR: if ($logError[E_COMPILE_ERROR]['log']) { $log = new \Innomatic\Logging\Logger($phpLog); $log->logEvent('Innomatic error handler', 'PHP generated a COMPILE ERROR at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage, \Innomatic\Logging\Logger::ERROR); } if ($logError[E_COMPILE_ERROR]['die']) { $this->abort('A compile error occured at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage); } break; case E_COMPILE_WARNING: if ($logError[E_COMPILE_WARNING]['log']) { $log = new \Innomatic\Logging\Logger($phpLog); $log->logEvent('Innomatic error handler', 'PHP generated a COMPILE WARNING at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage, \Innomatic\Logging\Logger::ERROR); } if ($logError[E_COMPILE_WARNING]['die']) { $this->abort('A compile warning occured at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage); } break; case E_USER_ERROR: if ($logError[E_USER_ERROR]['log']) { $log = new \Innomatic\Logging\Logger($phpLog); $log->logEvent('Innomatic error handler', 'PHP generated an USER ERROR at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage, \Innomatic\Logging\Logger::ERROR); } if ($logError[E_USER_ERROR]['die']) { $this->abort('An user error occured at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage); } break; case E_USER_WARNING: if ($logError[E_USER_WARNING]['log']) { $log = new \Innomatic\Logging\Logger($phpLog); $log->logEvent('Innomatic error handler', 'PHP generated an USER WARNING at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage, \Innomatic\Logging\Logger::ERROR); } if ($logError[E_USER_WARNING]['die']) { $this->abort('An user warning occured at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage); } break; case E_USER_NOTICE: if ($logError[E_USER_NOTICE]['log']) { $log = new \Innomatic\Logging\Logger($phpLog); $log->logEvent('Innomatic error handler', 'PHP generated an USER NOTICE at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage, \Innomatic\Logging\Logger::ERROR); } if ($logError[E_USER_NOTICE]['die']) { $this->abort('An user notice occured at line ' . $errorLine . ' of file ' . $errorFile . '. The error message was: ' . $errorMessage); } break; default: break; } }