Beispiel #1
0
 /**
  *  $this->_write( int $level )
  *      @param      int     $level  - log level 
  *      @return     void 
  *      @access     public
  */
 public function write($level)
 {
     openlog($this->ident, $this->openlog_opt, $this->facility) or die(ERROR_CANT_OPEN_SYSLOG);
     $this->to_string(&$this->last_log);
     syslog(self::$id2syslog[$level], $this->last_log) or die(ERROR_CANT_WRITE_SYSLOG);
     closelog() or die(ERROR_CANT_CLOSE_SYSLOG);
 }
Beispiel #2
0
 function fp_kill_enumeration()
 {
     openlog('wordpress(' . $_SERVER['HTTP_HOST'] . ')', LOG_NDELAY | LOG_PID, LOG_AUTH);
     syslog(LOG_INFO, "Attempted user enumeration from {$_SERVER['REMOTE_ADDR']}");
     closelog();
     wp_die('forbidden');
 }
Beispiel #3
0
 public function close()
 {
     if ($this->_isOpen) {
         return closelog();
     }
     return FALSE;
 }
function LogInfo($msg)
{
    global $argv;
    openlog($argv[0], LOG_PID, LOG_USER);
    syslog(LOG_INFO, $msg);
    closelog();
}
Beispiel #5
0
 /**
  * Closes the connection to the system logger, if it is open.
  * @access public
  */
 function close()
 {
     if ($this->_opened) {
         closelog();
         $this->_opened = false;
     }
 }
function events($text)
{
    $LOG_SEV = LOG_INFO;
    openlog("coova-chilli", LOG_PID, LOG_SYSLOG);
    syslog($LOG_SEV, $text);
    closelog();
}
Beispiel #7
0
function _log($text)
{
    openlog("wechat", LOG_PID | LOG_PERROR, LOG_LOCAL0);
    syslog(LOG_DEBUG, $text);
    closelog();
    return $text;
}
Beispiel #8
0
function processData()
{
    $flag = false;
    $firstName = $_POST['firstname'];
    if (strlen($firstName) == 0) {
        $flag = true;
    }
    $lastName = $_POST['lastname'];
    if (strlen($lastName) == 0) {
        $flag = true;
    }
    $emailAddress = $_POST['emailaddress'];
    if (strlen($emailAddress) == 0) {
        $flag = true;
    }
    if ($flag == false) {
        openlog('php', LOG_CONS | LOG_NDELAY | LOG_PID, LOG_USER | LOG_PERROR);
        syslog(LOG_ERR, 'Error!');
        syslog(LOG_INFO, "{$firstName} {$lastName} {$emailAddress}");
        closelog();
        echo "<style type='text/css'>#formContainer{display:none;}</style>";
        echo "\n\t\t\t\t\t\t\t\t\t\t<h3 class='FormLabel'>SUCCESS!</h3>\n\t\t\t\t\t\t\t\t\t\tThank you for creating an account {$firstName} {$lastName}!\n\t\t\t\t\t\t\t\t\t\tA confirmation email has been sent to {$emailAddress}.\n\t\t\t\t\t\t\t\t\t\tOnce you receive this email please follow the instructions\n\t\t\t\t\t\t\t\t\t\tprovided to active your new account.\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t<h6>This page will refresh in 10 seconds...</h6>\n\t\t\t\t\t\t\t\t\t";
        header("refresh:10;url=index.php");
    }
}
Beispiel #9
0
 public function log()
 {
     $argsNum = func_num_args();
     if ($argsNum < 2) {
         return false;
     }
     $args = func_get_args();
     $priority = $args[0];
     $message = $args[1];
     if ($priority > $this->allowPriority) {
         return false;
     }
     $priorityName = $this->getLevelName($priority);
     $strLog = '';
     if ($priorityName) {
         $strLog = "[{$priorityName}]";
     }
     $strLog .= "{$message}";
     for ($i = 2; $i < $argsNum; $i++) {
         $strLog .= $args[$i];
     }
     openlog('SPF', LOG_PID, LOG_USER);
     syslog($priority, $strLog);
     closelog();
 }
Beispiel #10
0
 public function writeLog($message = null, $code = null)
 {
     if (empty($this->message) && empty($message)) {
         return;
     } else {
         $this->message = $message;
     }
     if (empty($this->code) && empty($code)) {
         $this->code = 0;
     } else {
         $this->code = $code;
     }
     if (openlog(LoggingConfig::LOG_IDENT, LOG_PID | LOG_CONS, LoggingConfig::LOG_FACILITY) === true) {
         $entries = explode("\n", $this->message);
         foreach ($entries as $entry) {
             syslog(LOG_INFO, sprintf("(%s) [%s] %s %s %s - %s", $this->ip, $this->user, strtoupper($this->method), $this->code, $this->uri, $entry));
         }
         if (LoggingConfig::LOG_DEBUG == true && !empty($this->input) && $this->input != "null") {
             syslog(LOG_DEBUG, sprintf("(%s) [%s] Input: %s", $this->ip, $this->user, $this->input));
         }
         if (LoggingConfig::LOG_DEBUG == true && !empty($this->output) && $this->output != "null") {
             syslog(LOG_DEBUG, sprintf("(%s) [%s] Output: %s", $this->ip, $this->user, $this->output));
         }
         closelog();
     } else {
         trigger_error("Could not open syslog facility", E_USER_ERROR);
     }
 }
Beispiel #11
0
function Debuglogs($text = null, $function = null, $line = null)
{
    if (!$GLOBALS["DEBUG"]) {
        return;
    }
    if ($text == null) {
        return;
    }
    $linetext = null;
    if ($function == null) {
        if (function_exists("debug_backtrace")) {
            $trace = @debug_backtrace();
        }
        if (is_array($trace)) {
            $filename = basename($trace[1]["file"]);
            $function = $trace[1]["function"];
            $line = $trace[1]["line"];
        }
    }
    $linetext = $text;
    if ($function != null) {
        $linetext = "{$function}/{$line} {$linetext}";
    } else {
        if ($line != null) {
            $linetext = "{$line} {$linetext}";
        }
    }
    if (function_exists("syslog")) {
        $LOG_SEV = LOG_INFO;
        openlog("error_page", LOG_PID, LOG_SYSLOG);
        syslog($LOG_SEV, $linetext);
        closelog();
    }
}
Beispiel #12
0
 public function __destruct()
 {
     $this->teardown();
     $this->logMessage("BTG destructed");
     // Close syslog.
     closelog();
 }
Beispiel #13
0
function logMessage($type, $level, $message)
{
    global $debug;
    global $use_syslog;
    if ($use_syslog) {
        define_syslog_variables();
        if ($debug) {
        }
        if ($level == 0) {
            $s_level = LOG_ERR;
        } else {
            if ($level == 1) {
                $s_level = LOG_WARNING;
            } else {
                if ($level == 2) {
                    $s_level = LOG_INFO;
                } else {
                    if ($level == 3) {
                        $s_level = LOG_DEBUG;
                    } else {
                        $s_level = LOG_ERR;
                    }
                }
            }
        }
        $s_message = $type . " " . $message;
        openlog("restbot", LOG_PID, LOG_DAEMON);
        syslog($s_level, $s_message);
        closelog();
    }
}
Beispiel #14
0
 public static function init($ident, $facility)
 {
     if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
         self::$facilities['local0'] = LOG_LOCAL0;
         self::$facilities['local1'] = LOG_LOCAL1;
         self::$facilities['local2'] = LOG_LOCAL2;
         self::$facilities['local3'] = LOG_LOCAL3;
         self::$facilities['local4'] = LOG_LOCAL4;
         self::$facilities['local5'] = LOG_LOCAL5;
         self::$facilities['local6'] = LOG_LOCAL6;
         self::$facilities['local7'] = LOG_LOCAL7;
     }
     if (array_key_exists(strtolower($facility), self::$facilities)) {
         $facility = self::$facilities[strtolower($facility)];
     } elseif (!in_array($facility, array_values(self::$facilities), true)) {
         throw new \UnexpectedValueException('Unknown facility value "' . $facility . '"');
     }
     return function ($info) use($ident, $facility) {
         if (!openlog($ident, LOG_PID, $facility)) {
             throw new \LogicException('Can\'t open syslog for ident "' . $ident . '" and facility "' . $facility . '"');
         }
         syslog(Syslog::$levels[$info['level']], vsprintf('%1$s: %4$s', $info));
         closelog();
     };
 }
Beispiel #15
0
function _log($text)
{
    _trace($text);
    openlog("alarm", LOG_PID | LOG_PERROR, LOG_LOCAL0);
    syslog(LOG_DEBUG, var_export($text));
    closelog();
}
Beispiel #16
0
 /**
  * Write a message to the log
  *
  * @param array $messages
  * @throws \RuntimeException
  */
 public function write(array $messages)
 {
     openlog($this->identity, LOG_PID, $this->facility);
     foreach ($messages as $message) {
         syslog($this->logLevels[$message[1]], $this->formatRecord($message));
     }
     closelog();
 }
 /**
  * Closes the connection to the system logger, if it is open.
  * @access public
  */
 function close()
 {
     if ($this->_opened && !$this->_inherit) {
         closelog();
         $this->_opened = false;
     }
     return true;
 }
 /**
  * Writes log messages to syslog
  */
 public function export()
 {
     openlog($this->identity, LOG_ODELAY | LOG_PID, $this->facility);
     foreach ($this->messages as $message) {
         syslog($this->_syslogLevels[$message[1]], $this->formatMessage($message));
     }
     closelog();
 }
Beispiel #19
0
 public static function close()
 {
     self::$sDebug = false;
     self::$sConsole = true;
     if (self::$sSyslog) {
         closelog();
         self::$sSyslog = false;
     }
 }
 /**
  * Log error to syslog
  *
  * @param int		php error number
  * @param string	php error description
  * @param string	php file where the error occured
  * @param int		php line where the error occured
  * @return bool
  */
 public static function logToSyslog($errNo, $errStr, $errFile, $errLine)
 {
     $msg = sprintf("%s (errno: %d) in %s:%d", $errStr, $errNo, $errFile, $errLine);
     if (openlog("php-errors", LOG_PID | LOG_PERROR, LOG_LOCAL7)) {
         syslog(LOG_ERR, $msg);
         return closelog();
     }
     return FALSE;
 }
Beispiel #21
0
 /**
  * Log Commands to SysLog
  *
  * @param CommandInterface $command 
  * @param Callable $next
  * @return CommandInterface
  * @throws HandlerNotFoundException
  */
 public function __invoke(CommandInterface $command, callable $next = null)
 {
     openlog($this->syslog, LOG_PID | LOG_PERROR, LOG_LOCAL0);
     syslog(LOG_INFO, get_class($command));
     closelog();
     if (is_callable($next)) {
         return $next($command);
     }
     return $command;
 }
 public static function log($x)
 {
     openlog("newscoop admin test: ", LOG_PID | LOG_PERROR, LOG_LOCAL0);
     ob_start();
     var_dump($x);
     $d = ob_get_contents();
     ob_end_clean();
     var_dump(syslog(LOG_WARNING, $d . "\n"));
     closelog();
 }
 function stop()
 {
     $this->logg("Shutting down ...");
     // Sorry, have to go ...
     closelog();
     $this->closestd();
     // Simply close files
     exit(0);
     // and exit cleanly
 }
function ToSyslog($text)
{
    if (!function_exists("syslog")) {
        return;
    }
    $file = basename($file);
    $LOG_SEV = LOG_INFO;
    openlog($file, LOG_PID, LOG_SYSLOG);
    syslog($LOG_SEV, $text);
    closelog();
}
Beispiel #25
0
 /**
  * @name sysLog
  * @desc 采用 syslog 记录系统日志,操作系统必须为linux,记录至系统日志local4中,请修改/etc/syslog.conf文件
  * @param string $ident 日志
  * @param string $string 日志信息
  */
 public static function sysLog($ident, $errstr)
 {
     if (!defined('LOG_LOCAL4') && !empty($_ENV['OS']) && substr($_ENV['OS'], 0, 7) == 'Windows') {
         $filename = "syslog_" . date('Ymd') . '.log';
         return Log::customLog($filename, $errstr);
     } else {
         openlog($ident, LOG_PID | LOG_PERROR, LOG_SYSLOG);
         syslog(LOG_ALERT, $errstr);
         closelog();
     }
 }
Beispiel #26
0
 /**
  * Function to write the log messages to the syslog.
  * @param Array $args   Array of messages as given by the user to be written in log files.
  */
 public function log($args)
 {
     $message = $this->changeTemplate($args);
     //change the user given message appropriate to the template of the log files. This is necessary to maintain consistency among all the log files.
     openlog($this->syslogConfig['PHP_OPENLOG_IDENT'], $this->syslogConfig['PHP_OPENLOG_OPTION'], $this->syslogConfig['PHP_OPENLOG_FACILITY']);
     //open syslog with proper "OPTION" and "FACILITY"
     syslog($this->syslogConfig['PHP_SYSLOG_PRIORITY'], $message);
     //Write to SYSLOG with proper "priority"
     closelog();
     //close the SYSLOG after writing.
 }
Beispiel #27
0
 /**
  * Write on system log service
  * @param $logLevel
  * @param $message
  */
 public function write($logLevel, $message)
 {
     openlog('SplitIO', LOG_CONS | LOG_NDELAY | LOG_PID, LOG_USER);
     $_message = sprintf('<%s> %s', $logLevel, $message);
     if (isset($this->logLevels[$logLevel])) {
         syslog($this->logLevels[$logLevel], $_message);
     } else {
         syslog(LOG_INFO, $_message);
     }
     closelog();
 }
Beispiel #28
0
 public function save(array $messages)
 {
     // Open the connection to syslog
     openlog($this->config['ident'], LOG_CONS, LOG_USER);
     do {
         // Load the next message
         list($date, $type, $text) = array_shift($messages);
         syslog($this->syslog_levels[$type], $text);
     } while (!empty($messages));
     // Close connection to syslog
     closelog();
 }
Beispiel #29
-1
function _log($text)
{
    //$result = file_put_contents('wechat.log.'.date('Y-m-d'), $text."\n", FILE_APPEND);
    //if (!$result) {
    openlog("wechat", LOG_PID | LOG_PERROR, LOG_LOCAL0);
    syslog(LOG_DEBUG, $text);
    closelog();
    //}
}
Beispiel #30
-1
 /**
  * Sends log messages to syslog.
  * @param array $logs list of log messages.
  */
 protected function processLogs($logs)
 {
     static $syslogLevels = array(CLogger::LEVEL_TRACE => LOG_DEBUG, CLogger::LEVEL_WARNING => LOG_WARNING, CLogger::LEVEL_ERROR => LOG_ERR, CLogger::LEVEL_INFO => LOG_INFO, CLogger::LEVEL_PROFILE => LOG_DEBUG);
     openlog($this->identity, LOG_ODELAY | LOG_PID, $this->facility);
     foreach ($logs as $log) {
         syslog($syslogLevels[$log[1]], $this->formatLogMessage(str_replace("\n", ', ', $log[0]), $log[1], $log[2], $log[3]));
     }
     closelog();
 }