Feature Requests: Browse | Submit New | Admin

[#21107] SyslogLogger as logger

Date:
2008-07-07 14:22
Priority:
3
Submitted By:
Nobody
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
SyslogLogger as logger

Detailed description
It will be nice, if you provide SyslogLogger, too.
We use Syslog for everything.

I wrote a patch to provide SyslogLogger in server.

Instead this:

    begin
        @@logger = Logger.new(filename)
    rescue Exception => error
        raise "Error opening logger #{filename}: #{error}"
    end

use this:

    if filename =~ /^syslog:(.+)?$/
        prog = $1 ? $1 : File.basename( $0, '.rb')
        begin require 'syslog_logger'
        rescue LoadError
            if $!.message == 'no such file to load -- syslog_logger'
                raise "SyslogLogger not installed. Please install it >>gem install SyslogLogger<<,
if you want to use it or use file-logging."
            end
            raise
        end
        # Some code asks, if @@logger is a Logger-instance.
        # It isn't true, but SyslogLogger provides the same functionality,
        # so it returns true, if somebody asks @@logger, if it's a Logger-instance.
        SyslogLogger.class_eval do
            def kind_of?( c)  c == Logger || super( c)  end
        end
        @@logger = SyslogLogger.new prog
    else
        begin @@logger = Logger.new filename
        rescue Exception
            raise "Error opening logger #{filename}: #{$!}"
        end
    end

Add A Comment: Notepad

Please login


Followup

Message
Date: 2008-08-27 13:33
Sender: Dustin Spinhirne

what i've decided to do is to remove the parts of the code that
check for a Logger. this will allow you to pass in whatever type
of drop-in logger you want. everything should work provided that
the methods are compatible with the standard ruby Logger.

if you provide a String filename for the :logger option of the
tacacs_daemon, then a regular ruby Logger will be used by the
server.

these changes are in svn under the 1.0.0 release. i will be testing
this for a few weeks before releasing it.
Date: 2008-08-21 21:36
Sender: Dustin Spinhirne

had a coworker request this as well. i'll probably implement
it at some point in the near future.

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item