Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ability to log to syslog not just files #221

Closed
wants to merge 7 commits into from
Closed

ability to log to syslog not just files #221

wants to merge 7 commits into from

Conversation

andrus7k
Copy link

-o syslog will log to syslog

-o syslog will log to syslog
logger.addHandler(file_handler)
if output == 'syslog':
syslog = logging.handlers.SysLogHandler('/dev/log', facility=LOG_DAEMON)
syslog.setLevel(logging.INFO)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this, indentation for ants?

@josegonzalez
Copy link
Member

Can you add some documentation?

@andrus7k
Copy link
Author

useful if ur using mac, as the file is in /var/run/syslog or smt, not /dev/log as on most linuxes

if isSock:
syslog = logging.handlers.SysLogHandler(output, facility=LOG_DAEMON)
syslog.setLevel(logging.INFO)
syslog_formatter = logging.Formatter('%(name).24s[%(process)d]: %(message)s')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why aren't we respecting the formatter here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    if formatter is None:
        formatter = logging.Formatter('[%(asctime)s] %(levelname)-7s %(message)s')

this format kinda sucks for syslog

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's nonstandard behavior for beaver. If we want to change the defaults, fine, but this change makes it more difficult to reason about how it runs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok then all logging should be done in some stadart way by means ob logging.{conf/yml} whatever,
this functions does too much magic (overriding handlers for instance in ex. ) even without my patches

@ignasr
Copy link

ignasr commented Nov 28, 2013

This is a great feature. IMHO if logging to syslog, it should use syslog format.

use standard python logging.*
configured via logging.ini
@andrus7k
Copy link
Author

well now everyone can tune logging to their likeing

@JamieCressey
Copy link
Member

Hey @andrus7k, I'm just trying to do a bit of, much needed, housekeeping on the PRs.

This looks good, is it still required?

If so, please can you fix the merge conflicts and add tests cases around your new functionality so I can get this pulled in, if it's not required anymore I'll go ahead and close PR.

Thanks!

@JamieCressey
Copy link
Member

Ping @andrus7k I'll close this off in a couple of days with the assumption this PR isn't required any more.

@JamieCressey
Copy link
Member

Closed due to inactivity. Please reopen if you get chance to finish it off.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants