Hi

that's what I use in my .tac files

application = service.Application(mainPkgName)

#use this code below to configure logging in all aspects; keep in mind #that for the log rotating code the #access rights must be set such that the process has write access to #the log directory. A trick to adapt to #get a logfile with the demoted process's UID/GID is to have an already #existing file with all the properties #set. LogFile will from then on create rotated files with the same #properties.

application.setComponent(ILogObserver, FileLogObserver(LogFile('the.log', '/var/log/my-app', rotateLength=100000)).emit)

Werner

On 8/23/14 1:46 PM, Jonathan Vanasco wrote:
Christopher-

Thanks for the insight.  I was stupid and didn't include my code.

I don't actually want supervisor to handle the logging.  I wanted to
have this app's logs in /var/log/myapp-twisted/twisted.log

I just can't figure out how to make this happen.  i've been playing with
different permutations of twistd commands, redirect_stderr and
stdout_logfile, and haven't found the right balance

the actual logging calls are just to python's logger ( `import logging`
; logging.getLogger(), log.debug(), etc)

---------
[program:myapp-twisted]
priority=100
process_name=%(program_name)s
autostart=true
autorestart=true
stopsignal=QUIT
redirect_stderr = false
stdout_logfile = /var/log/myapp-twisted/twisted.log
directory = /var/www/sites/myapp-svn_tag-current_production/daemon/twisted
environment = PATH="/var/www/sites/myapp-virtualenv/bin:$PATH"
command = /var/www/sites/myapp-virtualenv/bin/twistd -y
controller-production.tac --pidfile /tmp/myapp-twisted.pid
----------





On Aug 22, 2014, at 11:50 PM, Christopher Armstrong wrote:


On August 22, 2014 at 6:52:02 PM, Jonathan Vanasco
(twisted-pyt...@2xlp.com <mailto:twisted-pyt...@2xlp.com>) wrote:

hoping someone can answer this question-

i can't seem to get my logging right while using supervisord

i'm not using twisted logging, just the regular python logging
infrastructure.

the two end-results I've had:

- everything double-logs into twistd.log & /var/log/supervisor.log
- anything this is `print`'ed appears in my twistd.log , but none of
the `log.debug()` lines appear

the end result I want, is for debug info from the twisted process to
be recorded in a single file


I prefer to use


twistd -n -l - ...


passing ‘-' to -l means “log to stdout”.


Without your code, we can’t know how you’re configuring python
logging, and what may be wrong with it. This should be the baseline
for using twistd with supervisor if you want to let supervisor handle
logging. FYI, you can configure supervisor to put the output in a
different file than /var/log/supervisor.log, too.


--
Christopher Armstrong
http://twitter.com/radix
http://wordeology.com/

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com <mailto:Twisted-Python@twistedmatrix.com>
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

// Jonathan Vanasco

c. 646.729.6436  |  415.501.9815
e. jonat...@2xlp.com <mailto:jonat...@2xlp.com>
w. http://findmeon.com/user/jvanasco
linkedin. http://linkedin.com/in/jonathanvanasco
blog. http://destructuring.net



_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python



_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to