dockerflow.logging.JsonLogFormatter is weird about %s style logging
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 50/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- observability
Hướng nghiên cứu
The formatter is dockerflow.logging.JsonLogFormatter, so start in the dockerflow/logging.py module and find where it builds the msg field from the log record. The bug appears when the %s argument is not a string, such as a dict, so check whether the formatter uses the raw record.msg instead of the formatted message. Done means logger.info("Hi %s", {'name': 'Peter'}) puts the rendered text in Fields.msg.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I have this config:
# Logging
LOGGING_USE_JSON = values.BooleanValue(True)
LOGGING_DEFAULT_LEVEL = values.Value("INFO")
@property
def LOGGING(self):
return {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"json": {
"()": "dockerflow.logging.JsonLogFormatter",
"logger_name": "buildhub",
},
"verbose": {"format": "%(levelname)s %(asctime)s %(name)s %(message)s"},
},
"handlers": {
"console": {
"level": self.LOGGING_DEFAULT_LEVEL,
"class": "logging.StreamHandler",
"formatter": ("json" if self.LOGGING_USE_JSON else "verbose"),
},
"sentry": {
"level": "ERROR",
"class": (
"raven.contrib.django.raven_compat.handlers" ".SentryHandler"
),
},
"null": {"class": "logging.NullHandler"},
},
"root": {"level": "INFO", "handlers": ["sentry", "console"]},
...
When I do:
In [1]: import logging
In [2]: logger = logging.getLogger("myproject")
In [3]: logger.info("Hi!")
{"Timestamp": 1541787363833421056, "Type": "myproject", "Logger": "buildhub", "Hostname": "MacBook-Pro-131.local", "EnvVersion": "2.0", "Severity": 6, "Pid": 68488, "Fields": {"msg": "Hi!"}}
In [4]: logger.info("Hi %s", "peter")
{"Timestamp": 1541787379742094080, "Type": "myproject", "Logger": "buildhub", "Hostname": "MacBook-Pro-131.local", "EnvVersion": "2.0", "Severity": 6, "Pid": 68488, "Fields": {"msg": "Hi peter"}}
In [5]: logger.info("Hi %s", {'name': 'Peter'})
{"Timestamp": 1541787416647823104, "Type": "myproject", "Logger": "buildhub", "Hostname": "MacBook-Pro-131.local", "EnvVersion": "2.0", "Severity": 6, "Pid": 68488, "Fields": {}}
Notice that when the param to logger.debug(template, THIS) isn't a string the final "msg" becomes empty ("Fields": {}).
- Ngôn ngữ chính
- Python
- Star
- 41
- Fork
- 21
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của mozilla-services/python-dockerflow
-
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 15/100
mozilla-services/python-dockerflow#119 · 1 bình luận ·
-
2023.8.0 distribution missingĐang mở
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 15/100
mozilla-services/python-dockerflow#117 · 1 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
mozilla-services/python-dockerflow#116 · 1 bình luận ·
-
Enhance core testsĐang mở
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 62/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
Tất cả issue của mozilla-services/python-dockerflow
Issue tương tự
-
customer-reported question
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Azure/azure-sdk-for-python#49548 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
btclib-org/btclib-wallet#409 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Phase 2 PSA Capability & Career Profile
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
bcgov/digital-journeys#2310 ·
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
fastmachinelearning/hls4ml#1582 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Sort modelsĐang mởenhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày