Hi, I''m wondering if it''s easy to add timestamps to the mongrel log? I am having a problem where an externally spawned application by Rails is failing. Mongrel kindly logs the error message returned by this application when it fails. But it doesn''t record a timestamp as to when the error occurs, which makes it a little tricky to sync this up to my webserver logs to figure out the execution path which is causing the error. Is there an easy way to add timestamping to logs in Mongrel for exception traps? I am using a hosting service (EngineYard) so ideally this isn''t something that requires a code change but can be done via configuration. Though I''m sure EY will do what''s necessary to make it happen, it''ll be better if the change is simple/low impact. Thanks for any advice! Steve
On Nov 20, 2007 1:06 PM, Steve Midgley <public at misuse.org> wrote:> Hi, > > I''m wondering if it''s easy to add timestamps to the mongrel log? I am > having a problem where an externally spawned application by Rails is > failing. Mongrel kindly logs the error message returned by this > application when it fails. But it doesn''t record a timestamp as to when > the error occurs, which makes it a little tricky to sync this up to my > webserver logs to figure out the execution path which is causing the > error. > > Is there an easy way to add timestamping to logs in Mongrel for > exception traps? I am using a hosting service (EngineYard) so ideally > this isn''t something that requires a code change but can be done via > configuration. Though I''m sure EY will do what''s necessary to make it > happen, it''ll be better if the change is simple/low impact. > > Thanks for any advice! > > SteveWe are actually adding this to Mongrel. Should be out in an upcoming release. It involves combing through the code :) I am about 75% through. ~Wayne
Steve, I just committed a change set to trunk that prepends Time.now.httpdate to most output strings. I am refactoring the logging to be more uniform and will be setting it up to log using the common logfile format: http://www.w3.org/Daemon/User/Config/Logging.html#common-logfile-format Hope this helps, ~Wayne
HOORAY! HOORAY! HOORAY! Jason On Nov 20, 2007, at 10:47 PM, Wayne E. Seguin wrote:> Steve, > > I just committed a change set to trunk that prepends Time.now.httpdate > to most output strings. > > I am refactoring the logging to be more uniform and will be setting it > up to log using the common logfile format: > http://www.w3.org/Daemon/User/Config/Logging.html#common-logfile- > format > > Hope this helps, > ~Wayne > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Jason Young -- Systems Manager, eXtension http://about.extension.org/wiki/Jason_Young ______________________________________ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20071121/11f05430/attachment.html
On Nov 21, 2007 3:08 PM, Jason Young <jason.young at ncsu.edu> wrote:> HOORAY! HOORAY! HOORAY! > > Jason:) Please let me know if you find any issues. Thanks, ~Wayne
Any word on this being in an official release? We''re currently on 1.1.1, and the timestamps don''t seem to appear, and I''m unable to find it in any changlog for other versions. Thanks! -- Posted via http://www.ruby-forum.com/.
Well, he committed it to trunk, but didn''t write any tests, so what am I supposed to do with that, really ;) . Evan On Feb 11, 2008 12:19 PM, Justin Winkler <lists at ruby-forum.com> wrote:> Any word on this being in an official release? We''re currently on 1.1.1, > and the timestamps don''t seem to appear, and I''m unable to find it in > any changlog for other versions. > > Thanks! > -- > Posted via http://www.ruby-forum.com/. > > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users >-- Evan Weaver Cloudburst, LLC
I added timestamps to my mongrel logs by adding these lines to config/environment.rb: class Logger def format_message(severity, timestamp, progname, msg) time = timestamp.getutc.strftime("%Y%m%d%H%M%S") "\n#{time}:#{severity.to_s.upcase}:#{$$}:#{msg}" end end It logs messages like this: Processing MyController#my_method (for 127.0.0.1 at 2007-12-29 14:37:54) [POST] 20071229133754:INFO:23386: Session ID: d7022e387306cc4e5fea107080014bf1 20071229133754:INFO:23386: Parameters: {"action"=>"my_method", "controller"=>"my", "id"=>"1"} 20071229133754:DEBUG:23386:ID = 1 The process id turned out to be extremely useful to debug some weird things my application started doing when moved from the single mongrel development environment to a multi mongrel one in production. Furthermore, sometimes the logs from two or more requests get mixed together (I guess that it can''t be helped) and the process id helps to connect a log line to its request. Paolo -- Posted via http://www.ruby-forum.com/.
On Feb 11, 2008 1:21 PM, Evan Weaver <evan at cloudbur.st> wrote:> Well, he committed it to trunk, but didn''t write any tests, so what am > I supposed to do with that, really ;) . >Justin, Checkout trunk, write some tests and it''ll get pushed out. I do not have the time to do this right now and won''t for a few more weeks at lest. ~Wayne -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20080213/c1130c07/attachment-0001.html
Wayne E. Seguin wrote:> On Nov 21, 2007 3:08 PM, Jason Young <jason.young at ncsu.edu> wrote: >> HOORAY! HOORAY! HOORAY! >> >> Jason > > :) > > Please let me know if you find any issues. > > Thanks, > > ~WayneAny changes of being able to "pipe" log(s) to "crono/rotatelogs" like a apache does ? -- Posted via http://www.ruby-forum.com/.