Skip to content
This repository has been archived by the owner. It is now read-only.

Ticket26683: allow logging to syslog #230

Closed
wants to merge 10 commits into from
Closed

Conversation

Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
@juga0
Copy link
Contributor

@juga0 juga0 commented Jul 7, 2018

No description provided.

juga0 added 2 commits Jul 7, 2018
Since sbws migth be run as a system service, it should give some
information to the system log.
There are no new options to configure for the user, and it's
disabled by default.
@juga0
Copy link
Contributor Author

@juga0 juga0 commented Jul 7, 2018

Didn't realize we already have #214.
Fixes #214.

Copy link
Member

@pastly pastly left a comment

Have you tested this?

After adding the requested config options, you'll need to use them in configure_logging in sbws/util/config.py. See where the formatters and handlers are set near the bottom of the function.

@@ -87,6 +87,8 @@ min_relays = 50
to_file = yes
# Whether or not to log to stdout
to_stdout = no
# Whether or not to log to syslog
to_syslog = no
Copy link
Member

@pastly pastly Jul 9, 2018

Please add to_syslog_level defaulting to ${level}.

Please add to_syslog_format (feel free to have it default to the string you like instead of ${format}

Copy link
Contributor Author

@juga0 juga0 Jul 10, 2018

i added then removed before opening this PR cause thought those settings doesn't probably need to be modified by users, however i'm not sure and it's fine for me to add them

[handler_to_syslog]
class=handlers.SysLogHandler
formatter=to_syslog
level = INFO
Copy link
Member

@pastly pastly Jul 9, 2018

Please don't set the level here so it is more straightforward to understand what messages will (not) be ignored.

Copy link
Contributor Author

@juga0 juga0 Jul 10, 2018

ok, as commented above

# syslog-like formatter
[formatter_to_syslog]
format = %(asctime)s %(module)s[%(process)s]: <%(levelname)s> %(message)s
datefmt = %b %d %H:%M:%S
Copy link
Member

@pastly pastly Jul 9, 2018

See previous commit about letting the user set the format with to_syslog_format.

If it isn't necessary to set the date format in order to send messages to the syslog, can we not set it? I've never tried logging to syslog, but I would expect it to set the date format as it wants and not rely on us. But I really don't know.

This section can most likely be empty like the other formatters.

Copy link
Contributor Author

@juga0 juga0 Jul 10, 2018

If it isn't necessary to set the date format in order to send messages to the syslog, can we not set it?

it wasn't the case time ago, but i'll check, i think you're right and that's not needed

@pastly pastly changed the title Ticket26683 Ticket26683: allow logging to syslog Jul 9, 2018
@juga0
Copy link
Contributor Author

@juga0 juga0 commented Jul 10, 2018

Yes i tested (and worked), will do the modifications you suggest

@juga0
Copy link
Contributor Author

@juga0 juga0 commented Jul 10, 2018

Made the changes you suggest

pastly
pastly approved these changes Jul 10, 2018
@pastly
Copy link
Member

@pastly pastly commented Jul 10, 2018

Closed via c0e6945..0306526

@pastly pastly closed this Jul 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.