Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/300.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在PasteDeploy ini文件中包含第三方记录器格式化程序?_Python_Pyramid_Paster - Fatal编程技术网

Python 如何在PasteDeploy ini文件中包含第三方记录器格式化程序?

Python 如何在PasteDeploy ini文件中包含第三方记录器格式化程序?,python,pyramid,paster,Python,Pyramid,Paster,我试图利用Pyramid和Pyramid_exlog在我的web应用程序出现异常时向第三方系统发送异常。不幸的是,我似乎无法使我的PasteDeploy development.ini正确识别格式化程序 我尝试了几种变体,包括: [formatter_exc_formatter] class=JsonFormatter() 我还尝试将pythonjsonlogger指定为我的pyramid的一部分,包括: pyramid.includes = pyramid_exclog, pythonj

我试图利用Pyramid和Pyramid_exlog在我的web应用程序出现异常时向第三方系统发送异常。不幸的是,我似乎无法使我的PasteDeploy development.ini正确识别格式化程序

我尝试了几种变体,包括:

[formatter_exc_formatter]
class=JsonFormatter()

我还尝试将pythonjsonlogger指定为我的pyramid的一部分,包括:

pyramid.includes = pyramid_exclog, pythonjsonlogger.jsonlogger
以及:

pyramid.includes = pyramid_exclog, pythonjsonlogger

在这一点上,我感到很困惑。我错过了什么?如何将自定义格式化程序包括到PasteDeploy托管应用程序中?

您需要从
类中删除
()

而不是:

[formatter_exc_formatter]
class=pythonjsonlogger.jsonlogger.JsonFormatter()
您需要执行以下操作:

[formatter_exc_formatter]
class=pythonjsonlogger.jsonlogger.JsonFormatter


pythonjsonlogger
不是金字塔模块,也没有金字塔为所有
金字塔调用的
includeme()
函数。includes

谢谢谢谢谢谢!我不知道为什么没有(),我就不尝试,但这非常有效。
[formatter_exc_formatter]
class=pythonjsonlogger.jsonlogger.JsonFormatter()
[formatter_exc_formatter]
class=pythonjsonlogger.jsonlogger.JsonFormatter