Edgewall Software

Opened 15 years ago

Last modified 3 years ago

#7820 new defect

[PATCH] Syslog Logging Not Working on FreeBSD — at Version 14

Reported by: david@… Owned by: Ryan J Ollos
Priority: normal Milestone: next-dev-1.7.x
Component: general Version: none
Severity: normal Keywords: patch syslog freebsd bitesized logging
Cc: packet@… Branch:
Release Notes:

The logger can be configured using a Configuration File.

API Changes:
Internal Changes:

Description

FreeBSD's syslog doesn't listen on /dev/log. It uses /var/run/log. Attached is a patch that allows you to specify the path to the UNIX socket instead of hardcoding it. It basically uses the logfile parameter, if it's None use /dev/log otherwise use it.

This bug affects all versions of Trac since about 0.7 it looks like.

Change History (19)

by david@…, 15 years ago

Attachment: syslog-path.patch added

Patch for 0.10-stable and trunk. Overrides handling of UNIX socket path via logfile parameter.

by david@…, 15 years ago

Attachment: syslog-removepath.patch added

It's also possible to just remove the explicit path, and everything Just Works(tm) (at least on Python 2.5.2).

comment:1 by Christian Boos, 15 years ago

Milestone: 0.13

My preference goes to attachment:syslog-removepath.patch.

Moving to 0.13 so that we don't have to bother with Python 2.3.

Should be verified for 2.4 as well, and on other platforms if needed (MacOS X?)

comment:2 by george@…, 14 years ago

Yes, this works for OS 10.6 with the built-in Python 2.6.

comment:3 by Remy Blank, 14 years ago

Cc: bitesized added

According to the Python documentation:

  • Passing no argument to SysLogHandler connects to the syslog via UDP port 514 on localhost.
  • Specifying a string argument to SysLogHandler is only documented since 2.5, but is actually supported earlier (2.3 is the oldest I checked), and connects to a UNIX socket.

Considering this, we could support both variants, which comes closer to the first patch:

  • Add a new parameter logdest.
  • If logdest starts with UDP:, we pass the remaining string as a hostname and log via UDP to that host (which could be localhost). This would also allow logging remotely.
  • Otherwise, logdest is passed as a string and we log to a UNIX socket.

Re-using logfile for this purpose is probably a bad idea, as the default value is trac.log.

comment:4 by Remy Blank, 14 years ago

Cc: bitesized removed
Keywords: bitesized added

Oops, wrong field :)

comment:5 by Ryan J Ollos, 9 years ago

#11216 closed as a duplicate, additionally requesting the ability to set the syslog facility. ticket:11216:logging_config.patch adds a log_config option which points to a dedicated logging configuration file.

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

Attachment: logging_config.patch added

Updated logging config patch. Adds the path, basename, project log format substitutions.

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

Attachment: logging.ini added

Logging config ini file to log to syslog on FreeBSD

comment:6 by Sebastian Klemke <packet@…>, 9 years ago

Cc: packet@… added

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

Patch to the admin panel to add log_config support.

comment:7 by Ryan J Ollos, 9 years ago

The patch looks pretty good. The biggest thing that will delay getting this committed is the lack of unit tests. If some unit tests were added this could be included in milestone:1.2.

comment:8 by Ryan J Ollos, 9 years ago

See also #11874. The proposed changes in that ticket would be a good follow-on to this ticket.

comment:9 by Ryan J Ollos, 9 years ago

Keywords: logging added
Milestone: next-major-releases1.2

comment:10 by Ryan J Ollos, 9 years ago

Owner: set to Ryan J Ollos
Status: newassigned

comment:11 by Ryan J Ollos, 9 years ago

Minor refactorings in [14333:14336].

Revised changes in log:rjollos.git:t7820_logging_config. The revised changes avoid API changes that were present in attachment:logging_config.patch. Some of those changes have been deferred to #11874 (comment:10:ticket:11874).

I'll do more testing and add unit tests.

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

comment:12 by Ryan J Ollos, 9 years ago

TODO Add documentation to TracLogging.

comment:13 by Jun Omae, 9 years ago

At least, we should use disable_existing_loggers=False for the logging.config.fileConfig(). I guess that call of the fileConfig() would stop loggers of other environments with multiple projects.

See:

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

comment:14 by Ryan J Ollos, 8 years ago

Release Notes: modified (diff)
Note: See TracTickets for help on using tickets.