dockerflow.logging.JsonLogFormatter is weird about %s style logging
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 50/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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": {}).
- 主要言語
- Python
- スター
- 41
- フォーク
- 21
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
mozilla-services/python-dockerflow のほかの issue
-
難易度 3/5 半日 初心者へのやさしさ 15/100
mozilla-services/python-dockerflow#119 · コメント 1 件 ·
-
難易度 2/5 1時間未満 初心者へのやさしさ 15/100
mozilla-services/python-dockerflow#117 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
mozilla-services/python-dockerflow#116 · コメント 1 件 ·
-
Enhance core testsオープン
難易度 3/5 半日 初心者へのやさしさ 62/100
-
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
mozilla-services/python-dockerflow の issue をすべて見る
似ている issue
-
Path subtraction removes repeated suffix characters instead of one suffix対応中かも @Gwerdonatus が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
joke2k/django-environ#671 ·
-
good first issue help wanted windows
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
-
test_pgbouncer deploys the server under test from Charmhub instead of the local build (track/1.31)オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
canonical/temporal-k8s-operator#195 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
`burr` fails to start when the Python path has a space in it対応中かも @enekoreto が今日担当しました。 オープンstatus/needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 5 日以内に返信
-
device support request
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
zigpy/zha-device-handlers#5461 ·
メンテナーはふだん 4 日以内に返信