Răsfoiți Sursa

COPY_SYSLOG_TO_STDERR (#2213)

Update of https://github.com/FreshRSS/FreshRSS/pull/2208
Fixes https://github.com/FreshRSS/FreshRSS/issues/2212
Alexandre Alapetite 7 ani în urmă
părinte
comite
b73d4c807f
4 a modificat fișierele cu 6 adăugiri și 2 ștergeri
  1. 1 1
      CHANGELOG.md
  2. 1 0
      Docker/Dockerfile
  3. 3 0
      constants.php
  4. 1 1
      lib/lib_rss.php

+ 1 - 1
CHANGELOG.md

@@ -11,7 +11,7 @@
 		* Performance: Disable unused Apache modules
 		* Add option to mount custom `.htaccess` for HTTP authentication
 		* Docker logs gets PHP syslog messages (e.g. from cron job and when fetching external content)
-	* Send a copy of PHP syslog messages to STDERR [#2208](https://github.com/FreshRSS/FreshRSS/pull/2208)
+	* New environment variable `COPY_SYSLOG_TO_STDERR` or in `constants.local.php` to copy PHP syslog messages to STDERR [#2213](https://github.com/FreshRSS/FreshRSS/pull/2213)
 	* Run Docker cron job with Apache user instead of root [#2208](https://github.com/FreshRSS/FreshRSS/pull/2208)
 	* Accept HTTP header `X-WebAuth-User` for delegated HTTP Authentication [#2204](https://github.com/FreshRSS/FreshRSS/pull/2204)
 * API

+ 1 - 0
Docker/Dockerfile

@@ -23,6 +23,7 @@ RUN rm -f /etc/apache2/conf.d/languages.conf /etc/apache2/conf.d/info.conf \
 	echo "17,37 * * * * su apache -s /bin/sh -c 'php /var/www/FreshRSS/app/actualize_script.php' 2>> /proc/1/fd/2 > /tmp/FreshRSS.log" >> \
 		/var/spool/cron/crontabs/root
 
+ENV COPY_SYSLOG_TO_STDERR On
 ENV CRON_MIN ''
 ENTRYPOINT ["./Docker/entrypoint.sh"]
 

+ 3 - 0
constants.php

@@ -32,6 +32,9 @@ safe_define('FRESHRSS_USERAGENT', 'FreshRSS/' . FRESHRSS_VERSION . ' (' . PHP_OS
 // PHP text output compression http://php.net/ob_gzhandler (better to do it at Web server level)
 safe_define('PHP_COMPRESSION', false);
 
+// For cases when syslog is not available
+safe_define('COPY_SYSLOG_TO_STDERR', isset($_SERVER['COPY_SYSLOG_TO_STDERR']) ? filter_var($_SERVER['COPY_SYSLOG_TO_STDERR'], FILTER_VALIDATE_BOOLEAN) : false);
+
 // Maximum log file size in Bytes, before it will be divided by two
 safe_define('MAX_LOG_SIZE', 1048576);
 

+ 1 - 1
lib/lib_rss.php

@@ -203,7 +203,7 @@ function html_only_entity_decode($text) {
 }
 
 function prepareSyslog() {
-	return openlog("FreshRSS", LOG_PERROR | LOG_PID, LOG_USER);
+	return COPY_SYSLOG_TO_STDERR ? openlog("FreshRSS", LOG_PERROR | LOG_PID, LOG_USER) : false;
 }
 
 function customSimplePie($attributes = array()) {