Ian Main
2009-Feb-17 21:23 UTC
[Ovirt-devel] [PATCH server] Add logging format to taskomatic
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
Jason Guiditta
2009-Feb-17 22:10 UTC
[Ovirt-devel] [PATCH server] Add logging format to taskomatic
ACK, this shows timestamp now, with one comment inline. On Tue, Feb 17, 2009 at 4:23 PM, Ian Main <imain at redhat.com> wrote:> 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"Why not include severity here as in default logger, especially since it is passed in?> > + end > +end > + > + > class TaskOmatic > > include MonitorMixin > -- > 1.6.0.6 > > _______________________________________________ > Ovirt-devel mailing list > Ovirt-devel at redhat.com > https://www.redhat.com/mailman/listinfo/ovirt-devel >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/ovirt-devel/attachments/20090217/970b594b/attachment.htm>