logs to both custom log and twistd.log

Bug #861234 reported by Robert Collins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
txlongpoll
Invalid
High
Julian Edwards

Bug Description

This is because log.startLoggingWithObserver isn't being called.

We should use either a custom log, or twistd.log, but not both. There will be interactions with twistd I suspect - bug see what we do in other LP daemons.

Revision history for this message
Robert Collins (lifeless) wrote :

to reproduce:
bin/txlongpoll amqp-longpoll -l mylog -u guest -a guest1 -f 9999 -r .
note that there is then both
mylog
and
twistd.log

Changed in txlongpoll:
status: Triaged → In Progress
assignee: nobody → Julian Edwards (julian-edwards)
Revision history for this message
Julian Edwards (julian-edwards) wrote :

It's not because log.startLoggingWithObserver isn't being called. See twisted bug 638 - there is no way of overriding application log observers from a TAP, so you end up with not only the observers we add to the service, the application gets a default whether you want it or not!

It was recently "fixed" in this changeset, I am yet to investigate whether we can backport it until it's properly released.

http://twistedmatrix.com/trac/changeset/32397

Revision history for this message
Julian Edwards (julian-edwards) wrote :
Revision history for this message
Julian Edwards (julian-edwards) wrote :

I've backported that twisted changeset and I am now getting a single log file. However, that change is bloody hideous - it requires you to write --logger=python.file.function_that_returns_observer - which means the log file name has to be hard coded in the logger! I've worked around that, but now have a new problem

This application's log observer *has* to be set up to receive all logging, otherwise the default observer takes over and you end up with 2 log files. Which means that oops_twisted's fallback observer is now doing the logging twice, so I need a way of making it only log failures there.

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 861234] Re: logs to both custom log and twistd.log

Create a function which returns an observer.
Set that as the '--logger=python.file.function_that_returns_observer' thing.

It should return an OOPSObserver with fallback set.

(This is the intended use: the oopsobserver receives *everything*,
translates failures to oopses and forwards non-failures unaltered.)

Revision history for this message
Julian Edwards (julian-edwards) wrote :

Gavin and I decided that this --logger option is so awful that we're not going to use it any more. The answer to this problem is to invoke the process like this:

twistd --logfile=/dev/null amqp-longpoll -u guest -a guest -f 34366 -l mylogname.log

which effectively removes the default logger.

Changed in txlongpoll:
status: In Progress → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.