0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Spring Boot】ログ出力をコンソールからファイルに切り替える方法

Posted at

アプリケーション開発を進めるにあたって、ログが毎回コンソールに出力される状態が不便に感じたので設定をしようと思います。

以下のページを参考にしました。
https://spring.pleiades.io/spring-boot/reference/features/logging.html#features.logging.file-output

設定方法

ログファイル出力の方法として、以下2種類のプロパティのどちらかを設定します。

logging.file.name
logging.file.path

両方のプロパティが設定されている場合、logging.file.nameの設定が反映されるようです。
今回はlogging.file.nameの設定を行います。

1.ログ出力ファイルを格納するディレクトリを作成する。

プロジェクトのルートディレクトリ直下でディレクトリを作成。
mkdir [ログを出力したいディレクトリ]

2.プロパティの設定
application.propertiesにプロパティの追加
logging.file.path=[作成したログ出力用のディレクトリ+ファイル名]

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?