/** * @param jILogMessage $message the message to log */ function logMessage($message) { global $gJConfig, $gJCoord; if (!is_writable(jApp::logPath())) { return; } $type = $message->getCategory(); if ($gJCoord && $gJCoord->request) { $conf =& $gJConfig->fileLogger; if (!isset($conf[$type])) { return; } $f = $conf[$type]; $ip = $gJCoord->request->getIP(); $f = str_replace('%ip%', $ip, $f); $f = str_replace('%m%', date("m"), $f); $f = str_replace('%Y%', date("Y"), $f); $f = str_replace('%d%', date("d"), $f); $f = str_replace('%H%', date("H"), $f); } else { // if there isn't a request, so jLog is called for an error during the construction // of the coordinator $f = 'errors.log'; $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'; } try { $sel = new jSelectorLog($f); $file = $sel->getPath(); @error_log(date("Y-m-d H:i:s") . "\t" . $ip . "\t{$type}\t" . $message->getFormatedMessage() . "\n", 3, $file); } catch (Exception $e) { $file = jApp::logPath('errors.log'); @error_log(date("Y-m-d H:i:s") . "\t" . $ip . "\terror\t" . $e->getMessage() . "\n", 3, $file); } }
/** * @param jILogMessage $message the message to log */ function logMessage($message) { $type = $message->getCategory(); if (jApp::coord()->request) { $ip = jApp::coord()->request->getIP(); } else { $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'; } error_log(date("Y-m-d H:i:s") . "\t" . $ip . "\t{$type}\t" . $message->getFormatedMessage(), 0); }
/** * @param jILogMessage $message the message to log */ function logMessage($message) { $type = $message->getCategory(); if (isset($this->catSyslog[$type])) { $priority = $this->catSyslog[$type]; } else { $priority = LOG_INFO; } syslog($priority, $message->getFormatedMessage()); }
/** * @param jILogMessage $message the message to log */ function logMessage($message) { if (!is_writable(jApp::logPath())) { return; } $type = $message->getCategory(); $appConf = jApp::config(); if ($appConf) { $conf =& jApp::config()->fileLogger; if (!isset($conf[$type])) { return; } $f = $conf[$type]; $f = str_replace('%m%', date("m"), $f); $f = str_replace('%Y%', date("Y"), $f); $f = str_replace('%d%', date("d"), $f); $f = str_replace('%H%', date("H"), $f); } else { $f = 'errors.log'; } $coord = jApp::coord(); if ($coord && $coord->request) { $ip = $coord->request->getIP(); } else { $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1'; } $f = str_replace('%ip%', $ip, $f); try { $sel = new jSelectorLog($f); $file = $sel->getPath(); @error_log(date("Y-m-d H:i:s") . "\t" . $ip . "\t{$type}\t" . $message->getFormatedMessage() . "\n", 3, $file); @chmod($file, jApp::config()->chmodFile); } catch (Exception $e) { $file = jApp::logPath('errors.log'); @error_log(date("Y-m-d H:i:s") . "\t" . $ip . "\terror\t" . $e->getMessage() . "\n", 3, $file); @chmod($file, jApp::config()->chmodFile); } }