Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Problem with Multiple Syslog Loggers #6

Open
tilo opened this Issue · 8 comments

4 participants

@tilo

I'm using multiple Syslog::Logger instances, and am experiencing a problem with it.

The Syslog::Logger instance that gets created first, gets log messages from all the other Syslog::Logger facilities as well, prefixed by their facility name - it also correctly logs it's own data without prefix.

@drbrain
Owner

This is a restriction of syslog(3).

Syslog uses openlog(3), but openlog(3) doesn't allow multiple names to be used for the same program. Managing switching between the various possible names is too difficult and error-prone to implement, unfortunately.

This behavior is described in the documentation:

https://github.com/seattlerb/sysloglogger/blob/master/lib/syslog_logger.rb#L12-L16

@drbrain drbrain closed this
@tilo

thank you for the quick reply..

@tilo

it should still be possible to write to multiple Syslog facilities from one program...

@drbrain drbrain reopened this
@drbrain
Owner

I think you are right, reopened.

@tilo

apparently with Lumberjack one can specify the facility as an option.
see: lumberjack_syslog_device-1.0.0/lib/lumberjack_syslog_device.rb

Also:

http://stackoverflow.com/questions/4042115/ruby-syslog-custom-facility

@mmartikainen

In Ruby 2.1 Syslog::Logger has support for writing to multiple facilities from the same app. See:
http://ruby-doc.org/stdlib-2.1.0/libdoc/syslog/rdoc/Syslog/Logger.html

@lowang

I've found gem that logs to syslog using tcp/udp: https://github.com/johnskopis/syslog_ruby
So you can have several loggers open at the same time with different progname - something that is unreachable for stdlib syslog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.