当restart <process_name>稿supervisorctl,有时重新启动过程并打印信息:
transmission:transmission_daemon_9100: stopped
transmission:transmission_daemon_9100: started
Run Code Online (Sandbox Code Playgroud)
这是预期的行为.但是,有时在发出命令后,supervisorctl即使成功重新启动进程,也只会挂起并打印任何内容.它为什么挂起并且什么都不打印?
在Google的404页面中,使用的html标记没有结束标记.您可以通过导航到www.googleusercontent.com自行查看代码.这不会在w3c验证程序上生成任何错误.这是为什么?
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 404 (Not Found)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}
</style>
<a href=//www.google.com/><img src=//www.google.com/images/errors/logo_sm.gif alt=Google></a>
<p><b>404.</b> <ins>That’s an error.</ins>
<p>The requested URL <code>/</code> was not found on this server. <ins>That’s all we know.</ins>
Run Code Online (Sandbox Code Playgroud) 我有一个 Flask Web 应用程序,Python 日志记录配置是在应用程序启动时通过dictConfig完成的。用于将某些日志写入数据库的处理程序附加到 logger 'test.module' 对该记录器生成的日志仅logging.basicConfig(level=logging.DEBUG)在应用程序启动时也被调用时才会写入数据库。否则不会将日志写入数据库。我知道 basicConfig 只是将一个 streamHandler 附加到根记录器。我认为这应该无关紧要,因为我不希望 root 记录器做任何事情。为什么没有 basicConfig 这不起作用?
我在下面添加了我如何启动记录器和我的配置。
class DbHandler(logging.Handler):
def __init__(self, level=logging.NOTSET):
logging.Handler.__init__(self, level)
def emit(self, record):
record.message = self.format(record)
log = DbModel()
log.message = record.message
log.save()
LOGGING = {
'version': 1,
'handlers': {
'db_log': {
'level': 'DEBUG',
'class': 'test.handlers.DbHandler',
},
},
'loggers': {
'test.important_module': {
'handlers': [
'db_log'
],
},
}
# logging.basicConfig(level=logging.DEBUG) # Doesnt work without this
logging.config.dictConfig(LOGGING)
logger = logging.getLogger('test.important_module')
logger.info('Making a test')
Run Code Online (Sandbox Code Playgroud)