Ticket #6687: fastcgi-log-routing.diff
File fastcgi-log-routing.diff, 1.9 KB (added by , 17 years ago) |
---|
-
django/core/servers/fastcgi.py
38 38 daemonize=BOOL whether to detach from terminal. 39 39 pidfile=FILE write the spawned process-id to this file. 40 40 workdir=DIRECTORY change to this directory when daemonizing 41 outlog=FILE write stdout to this file 42 errlog=FILE write stderr to this file 41 43 42 44 Examples: 43 45 Run a "standard" fastcgi process on a file-descriptor … … 69 71 'minspare': 2, 70 72 'maxchildren': 50, 71 73 'maxrequests': 0, 74 'outlog': None, 75 'errlog': None, 72 76 } 73 77 74 78 def fastcgi_help(message=None): … … 150 154 else: 151 155 return fastcgi_help("ERROR: Invalid option for daemonize parameter.") 152 156 157 daemon_kwargs = {} 158 if options['outlog']: 159 daemon_kwargs['out_log'] = options['outlog'] 160 if options['errlog']: 161 daemon_kwargs['err_log'] = options['errlog'] 162 153 163 if daemonize: 154 164 from django.utils.daemonize import become_daemon 155 become_daemon(our_home_dir=options["workdir"] )165 become_daemon(our_home_dir=options["workdir"], **daemon_kwargs) 156 166 157 167 if options["pidfile"]: 158 168 fp = open(options["pidfile"], "w") -
django/utils/daemonize.py
29 29 os.dup2(si.fileno(), sys.stdin.fileno()) 30 30 os.dup2(so.fileno(), sys.stdout.fileno()) 31 31 os.dup2(se.fileno(), sys.stderr.fileno()) 32 # set the custom file descriptors for python so they have correct buffering 33 sys.stdout, sys.stderr = so, se 32 34 else: 33 35 def become_daemon(our_home_dir='.', out_log=None, err_log=None): 34 36 """