From a387f0524fe85a98d70570345d58221868b193d5 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 19 Oct 2016 15:29:51 +0200 Subject: [PATCH 1/8] Add log writer PhpWriter refs #11652 --- .../Application/Logger/Writer/PhpWriter.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 library/Icinga/Application/Logger/Writer/PhpWriter.php diff --git a/library/Icinga/Application/Logger/Writer/PhpWriter.php b/library/Icinga/Application/Logger/Writer/PhpWriter.php new file mode 100644 index 000000000..8e9061280 --- /dev/null +++ b/library/Icinga/Application/Logger/Writer/PhpWriter.php @@ -0,0 +1,22 @@ + Date: Wed, 19 Oct 2016 15:34:57 +0200 Subject: [PATCH 2/8] LoggingConfigForm: make the webserver log option available refs #11652 --- application/forms/Config/General/LoggingConfigForm.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/forms/Config/General/LoggingConfigForm.php b/application/forms/Config/General/LoggingConfigForm.php index 35cd37a89..1ca6bf8dd 100644 --- a/application/forms/Config/General/LoggingConfigForm.php +++ b/application/forms/Config/General/LoggingConfigForm.php @@ -37,6 +37,7 @@ class LoggingConfigForm extends Form 'label' => $this->translate('Logging Type'), 'description' => $this->translate('The type of logging to utilize.'), 'multiOptions' => array( + 'php' => $this->translate('Webserver Log', 'app.config.logging.type'), 'syslog' => 'Syslog', 'file' => $this->translate('File', 'app.config.logging.type'), 'none' => $this->translate('None', 'app.config.logging.type') From ca8e4ea924be3c56b8fe195031868d4755d49ce4 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 3 Nov 2016 12:01:03 +0100 Subject: [PATCH 3/8] Conform to code style guidelines refs #11652 --- library/Icinga/Application/Logger/Writer/PhpWriter.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Application/Logger/Writer/PhpWriter.php b/library/Icinga/Application/Logger/Writer/PhpWriter.php index 8e9061280..98419823b 100644 --- a/library/Icinga/Application/Logger/Writer/PhpWriter.php +++ b/library/Icinga/Application/Logger/Writer/PhpWriter.php @@ -16,7 +16,8 @@ class PhpWriter extends LogWriter /** * {@inheritdoc} */ - public function log($severity, $message) { + public function log($severity, $message) + { error_log(Logger::$levels[$severity] . ' - ' . str_replace("\n", ' ', $message)); } } From a24999ff7fcdd50f0d4c3601255c885f7be96a24 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 3 Nov 2016 12:16:48 +0100 Subject: [PATCH 4/8] PhpWriter: throw an exception on logging failure refs #11652 --- library/Icinga/Application/Logger/Writer/PhpWriter.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/Icinga/Application/Logger/Writer/PhpWriter.php b/library/Icinga/Application/Logger/Writer/PhpWriter.php index 98419823b..51c2fea77 100644 --- a/library/Icinga/Application/Logger/Writer/PhpWriter.php +++ b/library/Icinga/Application/Logger/Writer/PhpWriter.php @@ -5,6 +5,7 @@ namespace Icinga\Application\Logger\Writer; use Icinga\Application\Logger; use Icinga\Application\Logger\LogWriter; +use Icinga\Exception\NotWritableError; /** * Log to the webserver log, a file or syslog @@ -18,6 +19,8 @@ class PhpWriter extends LogWriter */ public function log($severity, $message) { - error_log(Logger::$levels[$severity] . ' - ' . str_replace("\n", ' ', $message)); + if (! error_log(Logger::$levels[$severity] . ' - ' . str_replace("\n", ' ', $message))) { + throw new NotWritableError('Could not log to ' . (ini_get('error_log') ?: 'SAPI')); + } } } From 8952434393ab59a30bc6c61f3d3f9e4ee293ff3c Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 3 Nov 2016 12:35:40 +0100 Subject: [PATCH 5/8] PhpWriter: prefix messages with the app name as in Syslog refs #11652 --- .../Config/General/LoggingConfigForm.php | 4 ++-- .../Application/Logger/Writer/PhpWriter.php | 21 ++++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/application/forms/Config/General/LoggingConfigForm.php b/application/forms/Config/General/LoggingConfigForm.php index 1ca6bf8dd..6a5cb9238 100644 --- a/application/forms/Config/General/LoggingConfigForm.php +++ b/application/forms/Config/General/LoggingConfigForm.php @@ -63,7 +63,7 @@ class LoggingConfigForm extends Form ); } - if (false === isset($formData['logging_log']) || $formData['logging_log'] === 'syslog') { + if (false === isset($formData['logging_log']) || in_array($formData['logging_log'], array('syslog', 'php'))) { $this->addElement( 'text', 'logging_application', @@ -71,7 +71,7 @@ class LoggingConfigForm extends Form 'required' => true, 'label' => $this->translate('Application Prefix'), 'description' => $this->translate( - 'The name of the application by which to prefix syslog messages.' + 'The name of the application by which to prefix log messages.' ), 'requirement' => $this->translate('The application prefix must not contain whitespace.'), 'value' => 'icingaweb2', diff --git a/library/Icinga/Application/Logger/Writer/PhpWriter.php b/library/Icinga/Application/Logger/Writer/PhpWriter.php index 51c2fea77..913ea07de 100644 --- a/library/Icinga/Application/Logger/Writer/PhpWriter.php +++ b/library/Icinga/Application/Logger/Writer/PhpWriter.php @@ -5,6 +5,7 @@ namespace Icinga\Application\Logger\Writer; use Icinga\Application\Logger; use Icinga\Application\Logger\LogWriter; +use Icinga\Data\ConfigObject; use Icinga\Exception\NotWritableError; /** @@ -14,12 +15,30 @@ use Icinga\Exception\NotWritableError; */ class PhpWriter extends LogWriter { + /** + * Prefix to prepend to each message + * + * @var string + */ + protected $ident; + + /** + * {@inheritDoc} + */ + public function __construct(ConfigObject $config) + { + parent::__construct($config); + $this->ident = $config->get('application', 'icingaweb2'); + } + /** * {@inheritdoc} */ public function log($severity, $message) { - if (! error_log(Logger::$levels[$severity] . ' - ' . str_replace("\n", ' ', $message))) { + if (! error_log( + $this->ident . ': ' . Logger::$levels[$severity] . ' - ' . str_replace("\n", ' ', $message) + )) { throw new NotWritableError('Could not log to ' . (ini_get('error_log') ?: 'SAPI')); } } From 4689f224b5cfbcfd8c69d4149095b0c9f5cde5ef Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 3 Nov 2016 12:51:13 +0100 Subject: [PATCH 6/8] Fix missing translation refs #11652 --- .../locale/de_DE/LC_MESSAGES/icinga.mo | Bin 60998 -> 61067 bytes .../locale/de_DE/LC_MESSAGES/icinga.po | 5 +++++ 2 files changed, 5 insertions(+) diff --git a/application/locale/de_DE/LC_MESSAGES/icinga.mo b/application/locale/de_DE/LC_MESSAGES/icinga.mo index 3413b7cbff069bdec8a4239867b2db1b767e0dea..fff6fd30c554c4786172c9983231c64d477ae0c3 100644 GIT binary patch delta 10016 zcmX}y34Bf0+Q;#IL?$vxh>(a735g(yq=v*yXd(k5lu%V^XiY^C%Bd1#2YSpyX^UHW zl{UC;%~PseMC-P+HMBL|qSI~Pw!G^7{jK$R??-*tv(Daot@W&D?GyRj%CEf^UGj2Y z4z0e-;eSJ_IZhN-4|ALZFUPqPr(VZdoa#7&=%hJLC`4i_Y>90g$L$QI@faP;u@|03{y5?3j^m9vs2lrW1dc!-oPo^KnS(WP zzWsbD1`%(=5Zq@!KW+OjVr}|wVKC!659|kl%t8Z2VIa0b4cGybu?RcjJe-J?SP$E? zj4&)j4LA~YT^TAfd$18+zy){@=i{8VWSa4vz;-+Y+aQ0O3H;R^|Bg!a&)5N@xkxK5 z#$X(Yn($OqrWT=Az67;<8?2S6t-XVd(LcjXC<)!w>Bytui~TSF2U|y?GVy}_e721j zq4szcCg2flj(4mPnQR|%cdUbhu_Zo_+WQTtiC1Nk|128c*$Wa`rfzrwHSjom2WMbs zY(!qW;Bf4Z8&MOvhYc{c69tJ~P??;8Jlgq(?f(_^+~m%VlZzcYyG^QIp+gsbh)V5` zn1>HhsmxB!*hf$bf`}43C@d!7KdNd|u zLtKnga0gN!PBRKYH$H_d(wT|M(0iYfGQ>f=$L}lUzmf
faUt87(BN*R#j)tmw4tB;$q>dcl910GzQ4ctXDzclX6?pY_oOF!Fcq~L+Hyx|v zJE+XOi~e{BHPMr(TKEjzDz0y7B;rHV8!R!`T$q7A#NAPEz#Qy{FJd58;R3vjx_=}` zCI&sIH|I`lj;GNV|HK;T$~RjWkWc>A5k-em+7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?Fz&25J>#%3@kAVs3(y;{VjaAWWAHD$g~jL0v3|_` zFY`S<3LEml98AIGs8sDot^5o|;Z55g$})qAQ!x~~VGItz2rR<{T!G5iUM$Ao^JZeD zsQcYzG`iDRgq^V(>+8Y`X5~>BOWX@}exJc4d>b?IThs)-|6?W+hW^B9sEK4*i!gw= z6ce!=qjmnb(9nvHTWei3Z>|i~z#}kDH=ri4$$B2!5r_R^CX|nr#8XiNWn3}~>4qvn ze^iMEV<0|<_y7N&S7_9x<8{1-D^SO*;xaoG*P$2oxMKE7FH9w#jL+eE+=XGknoOKP zmE=15V4bVxh2@Wa#388hqS41qBY}oe-V%eb6RI}-QG4Ji)C#7cQajVe9@KqrVLf~g z>*5yl#hplsov%;>UbJ3AP3%vM(}VBQ(1Uz`GcylHJunfKs!Y$NxQ?!&p19_NTzQ_d z=4)Mrp6K{PuKu2@@kd>~J-b?DxdwY&2`ya(p7ewnB+Iicp{eT;Pjy1PYe41Qgg!3U z5YNL&--q<$voaSyLGaW)_$I#}^`s=9aSik|NGWjTRz8u^$mJU3DNUW^>RWj|b*Rgg zU)e8hzsuFf6Ou8>RaChk<7|GVXVzFR|Frfg8EvD|(>tVRCZ%O~{OA7VYF}BeeDsLQ J=~wHy{s#s^{M`Tm diff --git a/application/locale/de_DE/LC_MESSAGES/icinga.po b/application/locale/de_DE/LC_MESSAGES/icinga.po index d099a821b..935c5f8a3 100644 --- a/application/locale/de_DE/LC_MESSAGES/icinga.po +++ b/application/locale/de_DE/LC_MESSAGES/icinga.po @@ -2981,6 +2981,11 @@ msgctxt "app.config.logging.level" msgid "Warning" msgstr "Warnung" +#: /vagrant/application/forms/Config/General/LoggingConfigForm.php:40 +msgctxt "app.config.logging.type" +msgid "Webserver Log" +msgstr "Webserver-Log" + #: /vagrant/application/views/scripts/authentication/login.phtml:5 msgid "" "Welcome to Icinga Web 2. For users of the screen reader Jaws full and " From a85d259b0afc3a1fb25f27fb12b2b972fe7d5843 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 3 Nov 2016 14:06:02 +0100 Subject: [PATCH 7/8] PhpWriter: replace newlines in the message only if PHP logs to Syslog refs #11652 --- library/Icinga/Application/Logger/Writer/PhpWriter.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/Icinga/Application/Logger/Writer/PhpWriter.php b/library/Icinga/Application/Logger/Writer/PhpWriter.php index 913ea07de..310cd7678 100644 --- a/library/Icinga/Application/Logger/Writer/PhpWriter.php +++ b/library/Icinga/Application/Logger/Writer/PhpWriter.php @@ -36,9 +36,9 @@ class PhpWriter extends LogWriter */ public function log($severity, $message) { - if (! error_log( - $this->ident . ': ' . Logger::$levels[$severity] . ' - ' . str_replace("\n", ' ', $message) - )) { + if (! error_log($this->ident . ': ' . Logger::$levels[$severity] . ' - ' . ( + ini_get('error_log') === 'syslog' ? str_replace("\n", ' ', $message) : $message + ))) { throw new NotWritableError('Could not log to ' . (ini_get('error_log') ?: 'SAPI')); } } From 3189b5b12d8cd7190004dfba6e0179f6ca35de1c Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 4 Nov 2016 10:30:36 +0100 Subject: [PATCH 8/8] Make GeneralConfigStep::getSummary() working with all logging types refs #11652 --- .../library/Setup/Steps/GeneralConfigStep.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/modules/setup/library/Setup/Steps/GeneralConfigStep.php b/modules/setup/library/Setup/Steps/GeneralConfigStep.php index 002bd965b..95597f5c3 100644 --- a/modules/setup/library/Setup/Steps/GeneralConfigStep.php +++ b/modules/setup/library/Setup/Steps/GeneralConfigStep.php @@ -70,12 +70,24 @@ class GeneralConfigStep extends Step $loggingHtml = '

' . mt('setup', 'Logging will be disabled.') . '

'; } else { $level = $this->data['generalConfig']['logging_level']; + switch ($type) { + case 'syslog': + $typeText = t('Syslog', 'app.config.logging.type'); + break; + case 'php': + $typeText = t('Webserver Log', 'app.config.logging.type'); + break; + case 'file': + $typeText = t('File', 'app.config.logging.type'); + break; + } + $loggingHtml = '' . '' . '' . '' . '' - . '' + . '' . '' . '' . '' @@ -88,7 +100,7 @@ class GeneralConfigStep extends Step )) . '' . '' . '' - . ($type === 'syslog' ? ( + . ($type !== 'file' ? ( '' . '' ) : (
' . t('Type', 'app.config.logging') . '' . ($type === 'syslog' ? 'Syslog' : t('File', 'app.config.logging.type')) . '' . $typeText . '
' . t('Level', 'app.config.logging') . '
' . t('Application Prefix') . '' . $this->data['generalConfig']['logging_application'] . '