Blob Blame History Raw
From 0673479bb25bc000808465eae23d049804dc1415 Mon Sep 17 00:00:00 2001
From: Tomas Jelinek <tojeline@redhat.com>
Date: Thu, 21 Feb 2019 12:26:33 +0100
Subject: [PATCH 2/3] fix logging in pcsd

Fix a bug causing most of the messages not being logged. Introduced
in pcs-0.9.165 in commit 04d7e6a99beca700a2072406db671ef33d85c180.
---
 pcsd/bootstrap.rb | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pcsd/bootstrap.rb b/pcsd/bootstrap.rb
index 0246c48b..035574b5 100644
--- a/pcsd/bootstrap.rb
+++ b/pcsd/bootstrap.rb
@@ -67,11 +67,15 @@ if not defined? $cur_node_name
 end
 
 def configure_logger(log_device)
+  # Open the file ourselves so we can set its permissions for the case the file
+  # does not exist. Logger is able to create and open the file for us but it
+  # does not allow specifying file permissions.
   if log_device.is_a?(String)
     # File.open(path, mode, options)
     # File.open(path, mode, perm, options)
     # In order to set permissions, the method must be called with 4 arguments.
     log_device = File.open(log_device, "a+", 0600, {})
+    log_device.sync = true
   end
   logger = Logger.new(log_device)
   if ENV['PCSD_DEBUG'] and ENV['PCSD_DEBUG'].downcase == "true" then
-- 
2.17.0