Opened 20 years ago
Last modified 10 years ago
#3062 new enhancement
[PATCH] tracd should log to syslog when daemonized
| Reported by: | Owned by: | ||
|---|---|---|---|
| Priority: | low | Milestone: | unscheduled |
| Component: | web frontend/tracd | Version: | 0.9.5 |
| Severity: | minor | Keywords: | patch bitesized |
| Cc: | mwisnicki@… | Branch: | |
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
When running tracd -d it would be really nice if it logged to syslog so that one could look at what is going on as it runs.
Attachments (0)
Change History (12)
follow-up: 3 comment:1 by , 20 years ago
| Component: | general → tracd |
|---|---|
| Keywords: | https removed |
| Milestone: | → 0.10 |
| Owner: | changed from to |
| Priority: | normal → low |
| Severity: | normal → minor |
comment:2 by , 19 years ago
| Milestone: | 0.10 → 0.11 |
|---|
follow-up: 4 comment:3 by , 19 years ago
| Type: | defect → enhancement |
|---|
Replying to cboos:
But maybe we should warn if the mode is
stderr.
You'd have to open each project being served by tracd in the initialization before it's been daemonized, which seems kind of ugly. Since "stderr" is not the default logging mode I wouldn't think it's common for people to accidentally set the mode to "stderr" when running tracd as a daemon.
follow-up: 7 comment:4 by , 19 years ago
Replying to mgood:
Replying to cboos:
But maybe we should warn if the mode is
stderr.You'd have to open each project being served by tracd in the initialization before it's been daemonized …
An alternative solution would be to fallback to syslog if stderr can't be used:
--- a/trac/env.py Mon Aug 28 10:37:17 2006 +0200
+++ b/trac/env.py Wed Sep 06 09:15:18 2006 +0200
@@ -15,6 +15,7 @@
# Author: Jonas Borgström <jonas@edgewall.com>
import os
+import sys
from trac import db_default, util
from trac.config import *
@@ -263,6 +264,8 @@ class Environment(Component, ComponentMa
logfile = self.log_file
if logtype == 'file' and not os.path.isabs(logfile):
logfile = os.path.join(self.get_log_dir(), logfile)
+ if logtype == 'stderr' and not sys.stderr.isatty():
+ logtype = 'syslog'
self.log = logger_factory(logtype, logfile, self.log_level, self.path)
def get_known_users(self, cnx=None):
comment:5 by , 19 years ago
| Summary: | tracd should log to syslog when daemonized → [PATCH] tracd should log to syslog when daemonized |
|---|
comment:6 by , 16 years ago
| Keywords: | bitesized added |
|---|
comment:7 by , 15 years ago
| Milestone: | next-minor-0.12.x |
|---|---|
| Resolution: | → wontfix |
| Status: | new → closed |
An alternative solution would be to fallback to
syslogifstderrcan't be used:
trac/env.py
a b class Environment(Component, ComponentMa 263 264 logfile = self.log_file 264 265 if logtype == 'file' and not os.path.isabs(logfile): 265 266 logfile = os.path.join(self.get_log_dir(), logfile) 267 if logtype == 'stderr' and not sys.stderr.isatty(): 268 logtype = 'syslog'
Scratch that, stderr could redirected to a file or a pipe (tee).
Well, since the original request, nobody has shown much interest in that feature which can be easily "fixed" by using a proper configuration.
comment:8 by , 12 years ago
| Resolution: | wontfix |
|---|---|
| Status: | closed → reopened |
Unless I'm missing something, you can only configure per instance/environment logging but global messages (like "Server starting in PID") go either to stdout or null if daemonized ?
comment:9 by , 12 years ago
| Cc: | added |
|---|
comment:10 by , 12 years ago
| Milestone: | → unscheduled |
|---|
So this is not about "logging" and more about print statements and the call to daemonize that redirects them to /dev/null.
Should it redirect stdout (and stderr?) to /dev/log instead? (Or ‘/var/run/syslog’ on OS/X?) Offer a command line option? Use the logging framework instead of print statements?
comment:11 by , 10 years ago
| Owner: | removed |
|---|---|
| Status: | reopened → new |
comment:12 by , 10 years ago
| Keywords: | patch added |
|---|



Well, you have other valid choices:
filewinlogon Windows.But maybe we should warn if the mode is
stderr.