1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Lambdaでloggingすると同じログが2つ出てしまう人向け

Last updated at Posted at 2019-05-23

概要

Lambdaには最初からルートロガーに LambdaLoggerHandler というのが登録されているので、ログの整形がしたいとかで自前のハンドラを追加で登録していると、ログが二重に出るようになる。

自前で登録しようとしてる人以外は知らない。

propergate=Falseとかすると良いかも。。

確認

import logging
logger = logging.getLogger()
print(logger.handlers)

↑をLambda上で実行すると、

[<LambdaLoggerHandler (NOTSET)>]

コマンドラインから実行すると、

[]

関連

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?