Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a unified logging system for Ruby?

I was wondering if there are any truly unified logging systems out there that can support Rails and delayed jobs, and are relatively easy to set up.

I want to be able to log to the same server/file for any execution context in my application (Rails, delayed jobs, etc), even if i'm not currently in a Rails context.

Love the Rails logger, but I can't log to it while in a Resque job. Any ideas?

like image 856
Jacob Relkin Avatar asked Feb 25 '23 19:02

Jacob Relkin


1 Answers

Do you mean a file-logger, similar to syslog?

Ruby's got both Logger and Syslog.

Logger can do log rolling, handles severity levels, and is used in a lot of Ruby modules for logging. You can define the name of the file to log to, or use STDOUT/STDERR or an IO stream.

The docs for syslog are pretty barebones, but you can get info by browsing its source code, or reading the Ruby Syslog README.

like image 143
the Tin Man Avatar answered Mar 08 '23 12:03

the Tin Man