case 'syslog':
try {
- $logger = new SyslogLogger($this->channel, $introspection, $loglevel);
+ $logger = new SyslogLogger($this->channel, $introspection, $loglevel, $config->get('system', 'syslog_flags', SyslogLogger::DEFAULT_FLAGS), $config->get('system', 'syslog_facility', SyslogLogger::DEFAULT_FACILITY));
} catch (LogLevelException $exception) {
// If there's a wrong config value for loglevel, try again with standard
$logger = $this->create($database, $config, $profiler, $fileSystem, LogLevel::NOTICE);
{
const IDENT = 'Friendica';
+ /** @var int The default syslog flags */
+ const DEFAULT_FLAGS = LOG_PID | LOG_ODELAY | LOG_CONS;
+ /** @var int The default syslog facility */
+ const DEFAULT_FACILITY = LOG_USER;
+
/**
* Translates LogLevel log levels to syslog log priorities.
* @var array
* @throws LogLevelException
* @throws LoggerException
*/
- public function __construct($channel, Introspection $introspection, string $level = LogLevel::NOTICE, int $logOpts = LOG_PID, int $logFacility = LOG_USER)
+ public function __construct($channel, Introspection $introspection, string $level = LogLevel::NOTICE, int $logOpts = self::DEFAULT_FLAGS, int $logFacility = self::DEFAULT_FLAGS)
{
parent::__construct($channel, $introspection);
$this->logOpts = $logOpts;
// Sets the logging adapter of Friendica globally (monolog, syslog, stream)
'logger_config' => 'stream',
+ // syslog flags (Integer)
+ // Sets the syslog flags in case 'logger_config' is set to 'syslog'
+ 'syslog_flags' => LOG_CONS | LOG_PID | LOG_ODELAY,
+
+ // syslog flags (Integer)
+ // Sets the syslog facility in case 'logger_config' is set to 'syslog'
+ 'syslog_facility' => LOG_USER,
+
// maintenance_start (String)
// Start of the window for the daily maintenance cron call.
// The system timezone is used when no timezone is defined here.
'FRIENDICA_LOGFILE' => ['system', 'logfile'],
'FRIENDICA_LOGLEVEL'=> ['system', 'loglevel'],
'FRIENDICA_PROFILING' => ['system', 'profiler'],
+ 'FRIENDICA_LOGGER' => ['system', 'logger_config'],
+ 'FRIENDICA_SYSLOG_FLAGS' => ['system', 'syslog_flags'],
+ 'FRIENDICA_SYSLOG_FACILITY' => ['system', 'syslog_facility'],
// Caching
'FRIENDICA_CACHE_DRIVER' => ['system', 'cache_driver'],