简体   繁体   English

Python日志框架

[英]Python logging framework

I'm looking for recommendations on a python logging framework python within a microservice.我正在寻找有关微服务中的 python 日志记录框架 python 的建议。 There's the built in logging system provided by python, there's structlogger.有python提供的内置日志系统,还有structlogger。 Currently I use structlogger with an ELK stack with filebeat instead of logstash.目前,我将 structlogger 与带有 filebeat 而不是 logstash 的 ELK 堆栈一起使用。 Please let me know what you would recommend and why?请让我知道您会推荐什么以及为什么? My usual criterial is popularity on stackoverflow (I'm not kidding), as it makes it a lot easier to get over technical issues or bugs.我通常的标准是在 stackoverflow 上的受欢迎程度(我不是在开玩笑),因为它可以更轻松地解决技术问题或错误。

Use the builtin logging module.使用内置的logging模块。

It does pretty much anything you need.它几乎可以做您需要的任何事情。 structlogger isn't really a different framework and more of a default configuration for the builtin logging module. structlogger并不是一个真正不同的框架,更像是内置日志模块的默认配置。 Also if you need something other than just logging to files or stdout the builtin module has a lot of handlers, and there exist a lot of third party handlers that work with the builtin module.此外,如果您需要的不仅仅是记录到文件或标准输出,则内置模块有很多处理程序,并且存在许多与内置模块一起使用的第三方处理程序。 (eg graylog) (例如灰色日志)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM