[Ovirt-devel] [PATCH server] Add logging format to taskomatic

Ian Main imain at redhat.com
Tue Feb 17 21:23:39 UTC 2009


Sadly there's a bug in rails that overrides the logger format causing
the non-existant formatting we were seeing.  This is ugly but fixes the
issue.

Signed-off-by: Ian Main <imain at redhat.com>
---
 src/task-omatic/taskomatic.rb |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/task-omatic/taskomatic.rb b/src/task-omatic/taskomatic.rb
index 65aac32..f6f7f39 100755
--- a/src/task-omatic/taskomatic.rb
+++ b/src/task-omatic/taskomatic.rb
@@ -35,6 +35,19 @@ require 'task_vm'
 require 'task_storage'
 require 'vnc'
 
+# This sad and pathetic readjustment to ruby logger class is
+# required to fix the formatting because rails does the same
+# thing but overrides it to just the message.
+#
+# See eg: http://osdir.com/ml/lang.ruby.rails.core/2007-01/msg00082.html
+#
+class Logger
+  def format_message(severity, timestamp, progname, msg)
+    "#{timestamp} (#{$$}) #{msg}\n"
+  end
+end
+
+
 class TaskOmatic
 
   include MonitorMixin
-- 
1.6.0.6




More information about the ovirt-devel mailing list