Edgewall Software
Modify

Opened 19 years ago

Last modified 9 years ago

#3062 new enhancement

[PATCH] tracd should log to syslog when daemonized

Reported by: edahlman@… 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)

comment:1 by Christian Boos, 19 years ago

Component: generaltracd
Keywords: https removed
Milestone: 0.10
Owner: changed from Jonas Borgström to Christian Boos
Priority: normallow
Severity: normalminor

Well, you have other valid choices:

  • file
  • winlog on Windows.

But maybe we should warn if the mode is stderr.

comment:2 by Christian Boos, 19 years ago

Milestone: 0.100.11

in reply to:  1 ; comment:3 by Matthew Good, 18 years ago

Type: defectenhancement

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.

in reply to:  3 ; comment:4 by Christian Boos, 18 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 Matthew Good, 18 years ago

Summary: tracd should log to syslog when daemonized[PATCH] tracd should log to syslog when daemonized

comment:6 by Remy Blank, 15 years ago

Keywords: bitesized added

in reply to:  4 comment:7 by Christian Boos, 15 years ago

Milestone: next-minor-0.12.x
Resolution: wontfix
Status: newclosed

An alternative solution would be to fallback to syslog if stderr can't be used:

  • trac/env.py

    a b class Environment(Component, ComponentMa  
    263264        logfile = self.log_file
    264265        if logtype == 'file' and not os.path.isabs(logfile):
    265266            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 Marcin Wisnicki <mwisnicki@…>, 11 years ago

Resolution: wontfix
Status: closedreopened

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 Marcin Wisnicki <mwisnicki@…>, 11 years ago

Cc: mwisnicki@… added

comment:10 by Peter Suter, 11 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 Ryan J Ollos, 10 years ago

Owner: Christian Boos removed
Status: reopenednew

comment:12 by figaro, 9 years ago

Keywords: patch added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.