/**
  * Build a new logging handler based on files.
  */
 public function __construct()
 {
     $config = SimpleSAML_Configuration::getInstance();
     assert($config instanceof SimpleSAML_Configuration);
     // get the metadata handler option from the configuration
     $this->logFile = $config->getPathValue('loggingdir', 'log/') . $config->getString('logging.logfile', 'simplesamlphp.log');
     $this->processname = $config->getString('logging.processname', 'SimpleSAMLphp');
     if (@file_exists($this->logFile)) {
         if (!@is_writeable($this->logFile)) {
             throw new Exception("Could not write to logfile: " . $this->logFile);
         }
     } else {
         if (!@touch($this->logFile)) {
             throw new Exception("Could not create logfile: " . $this->logFile . " Loggingdir is not writeable for the webserver user.");
         }
     }
     SimpleSAML\Utils\Time::initTimezone();
 }
Exemple #2
0
         * See PHP bug: https://bugs.php.net/bug.php?id=47987
         */
        return false;
    }
    if ($errno & SimpleSAML_Utilities::$logMask || !($errno & error_reporting())) {
        // masked error
        return false;
    }
    static $limit = 5;
    $limit -= 1;
    if ($limit < 0) {
        // we have reached the limit in the number of backtraces we will log
        return false;
    }
    // show an error with a full backtrace
    $e = new SimpleSAML_Error_Exception('Error ' . $errno . ' - ' . $errstr);
    $e->logError();
    // resume normal error processing
    return false;
}
set_error_handler('SimpleSAML_error_handler');
$configdir = SimpleSAML\Utils\Config::getConfigDir();
if (!file_exists($configdir . '/config.php')) {
    header('Content-Type: text/plain');
    echo "You have not yet created the simpleSAMLphp configuration files.\n";
    echo "See: https://simplesamlphp.org/docs/devel/simplesamlphp-install-repo\n";
    exit(1);
}
// set the timezone
SimpleSAML\Utils\Time::initTimezone();