1
0

More than 3 years have passed since last update.

Cloud RunでNode.jsのconsole.log, debug, warn, errorでログ出力するとどのように表示されるか

Posted at

公式に記載の通りCloud RunのログはStackdriver Logging に自動的に送信されます。

下図のデフォルトのログ出力を確認すると500エラーで左のアイコンが !! になっていたり、404エラーで ! になっていたりします。

スクリーンショット 2020-01-27 11.20.41.png

Stackdriverのドキュメントを確認すると9つのレベルが用意されており、Node.jsで以下のログ出力を行った場合にどのように表示されるのか確認しました。

    console.log('This is log.')
    console.debug('This is debug.')
    console.warn('This is warn.')
    console.error('This is error.')

結果は下図の通りで、全て同じレベルで表示されました。

スクリーンショット 2020-01-27 11.28.32.png

レベルで制御する場合はStackdriver Logging クライアント ライブラリを使用して出力する必要があるかもしれません。

1
0
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
0