Edgewall Software

Opened 11 years ago

Last modified 8 years ago

#11216 closed enhancement

[PATCH] Make syslog facility and socket configurable — at Version 7

Reported by: Sebastian Klemke <packet@…> Owned by:
Priority: normal Milestone:
Component: general Version:
Severity: normal Keywords: syslog patch
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Ryan J Ollos)

To filter trac log entries and store them in a separate log file with syslog-type logging, the syslog facility must be configurable. Otherwise, trac log entries cannot be distinguished from other log entries using the same facility. Using file-type logging is not an option for me, as I don't know how to safely rotate the resulting log files.

Therefore, I wrote a patch to configure the syslog facility and the syslog socket using the new options log_facility and log_socket for syslog-type logging. log_facility is needed to distinguish trac log entries from other application's log entries. log_socket is needed for operating systems where the syslog socket is not named /dev/log.

Change History (10)

by Sebastian Klemke <packet@…>, 11 years ago

Attachment: syslog.patch added

Patch to add log_socket and log_facility options. Applies to trunk@11822

comment:1 by Christian Boos, 11 years ago

Have you investigated if and how it would be possible to pass this extra information via the logging.config module? Given that beyond the basics, the logging module can be configured in a very extensive way, I think it would make more sense to offer this extra level of configuration via a dedicated configuration file rather than by extending the Trac logging API itself.

Besides, another possibility for you would be to specify the use of a RotatingFileHandler (also via this logging.config file).

comment:2 by Sebastian Klemke <packet@…>, 11 years ago

Thank you for your feedback. I did not investigate this option, but will try if time permits. It seems that another trac patch is required to use logging.config. I will try to implement logging.config as a new log_type with a log_config option for the filename of the config file and see what can be done with it.

Last edited 8 years ago by Ryan J Ollos (previous) (diff)

by Sebastian Klemke <packet@…>, 11 years ago

Attachment: logging_config.patch added

Patch introducing logging.config support. Applies to source:trunk@11822

by Sebastian Klemke <packet@…>, 11 years ago

Attachment: logging.ini added

Example log configuration

comment:3 by Sebastian Klemke <packet@…>, 11 years ago

I wrote another patch adding logging.config support. It adds a new log_type config and a new option log_config for the configuration file. The patch has some rough edges:

  • It prevents environment initialization if configuration file is missing or defective
  • I had to remove the _trac_handler attribute from the logger (seems to be unused)
  • There seems to be no way of determining the used handler. Therefore I return None for the handler, effectively preventing flush() in Environment.shutdown()
  • Keyword substitution of $(path)s, $(basename)s and $(project)s is not possible for the new log type config

comment:4 by Sebastian Klemke <packet@…>, 11 years ago

Concerning RotatingFileHandler: I doubt it would work with multiple mod_wsgi processes.

Last edited 9 years ago by Ryan J Ollos (previous) (diff)

comment:5 by Christian Boos, 11 years ago

Milestone: next-dev-1.1.x

Looks like good start! Unfortunately I won't be able to review your patch until end of next week, so I'd welcome any other TracTeam member to pick it up from there.

comment:6 by Ryan J Ollos, 9 years ago

Keywords: patch added

comment:7 by Ryan J Ollos, 9 years ago

Description: modified (diff)
Keywords: bitesized added
Note: See TracTickets for help on using tickets.