I am using supervisor 3.0a6 with python 2.5 and tried to use the
%(process_num)02d expansion in the stdout_logfile option of the config
file and got a KeyError exception.  Found bug #268  on the plone site
then looked through the archives of Supervisor-checkins and found r809
which is a fix for the #268 bug.  Tried it and it did not work for me
with this substitution:
  stdout_logfile=%(program_name)s%(process_num)02d.log
with KeyError for key program_name.  After looking at the patch, I
rearranged the code a bit and it seems to be working now.  Anyway, I
hope this fix is correct and thought I'd share it.  Supervisor rocks!
 
 
The original part of the patch in r809 looked like this:
@@ -764,10 +753,10 @@
 
             for k in ('stdout', 'stderr'):
                 n = '%s_logfile' % k
-                val = logfile_name(get(section, n, Automatic))
-                if isinstance(val, basestring):
-                    val = expand(val, expansions, n)
-                logfiles[n] = val
+                lf_val = logfile_name(get(section, n, Automatic))
+                if isinstance(lf_val, basestring):
+                    lf_val = expand(lf_val, expansions, n)
+                logfiles[n] = lf_val
 
                 bu_key = '%s_logfile_backups' % k
                 backups = integer(get(section, bu_key, 10))

The fixed patch looks like this:
@@ -764,10 +753,11 @@
 
             for k in ('stdout', 'stderr'):
                 n = '%s_logfile' % k
-                val = logfile_name(get(section, n, Automatic))
-                if isinstance(val, basestring):
-                    val = expand(val, expansions, n)
-                logfiles[n] = val
+                lf_val = get(section, n, Automatic)
+                if isinstance(lf_val, basestring):
+                    lf_val = expand(lf_val, expansions, n)
+                lf_val = logfile_name(lf_val)
+                logfiles[n] = lf_val
 
                 bu_key = '%s_logfile_backups' % k
                 backups = integer(get(section, bu_key, 10))

_______________________________________________
Supervisor-users mailing list
Supervisor-users@lists.supervisord.org
http://lists.supervisord.org/mailman/listinfo/supervisor-users

Reply via email to