
Thank you Jean-Paul It works ok using the PythonLoggingObserver Regards 2014-04-30 13:55 GMT+02:00 <exarkun@twistedmatrix.com>:
On 08:57 am, juanito1982@gmail.com wrote:
Hello,
I am trying to modify loglevel withou result. I configure my app logging inside the tac file as:
You omitted the imports necessary to interpret the example code with certainty but I'll make some guesses. Next time post a complete, self- contained example.
This line:
logging.basicConfig(level=logging.ERROR, format="%(asctime)s --- %(name)s - %(levelname)s - %(message)s")
configures the standard library logging module.
This line:
logfile = DailyLogFile("gdumper.log", "/var/log")
creates a log writer from the Twisted logging system that will write to a file.
And this line:
application.setComponent(ILogObserver, FileLogObserver(logfile).emit)
makes `twistd` configure Twisted's logging system with a log observer that will use that log writer to record log events.
Twisted's logging system and the standard library logging system are separate things, though. Configuring the standard library logging system will not make any difference to Twisted's logging system.
If you want log messages emitted by `log.msg` and `log.err` to traverse the standard library logging system then the minimum you need to do is use `twisted.python.log.PythonLoggingObserver` instead of `FileLogObserver`.
`PythonLoggingObserver` observes log events in the Twisted logging system and sends them to the standard library logging system.
Once you do that you may be able to configure the standard library logging system to behave as you desire.
Jean-Paul
logging.basicConfig call seems do not apply as I get both log.msg and
log.err messages into the log. Is there any other way to set up log level?
Regards
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python