LoginSignup
2
1

More than 1 year has passed since last update.

Intellijで@slf4jでログ出力しようとするとcannot find symbol logのエラーが出る

Last updated at Posted at 2022-01-14

概要

IntellijでSpring Bootで@slf4jを使って log.debug("Sample") のようにログを出力しようとすると、 cannot find symbol log というエラーが発生し、Compileが失敗する。その対処方法。

Versions

  • Intellij Ultimate 2021.3.1
  • Spring Boot 2.5.6

Enable annotaion processing

Preference > Build, Excecution, Deployment > Compiler > Annotation Processors
「Enable annotation processing」にチェックを入れる。
Screen Shot 2022-01-14 at 13.32.14.png

Plugin

Lombockをインストールする。
Screen Shot 2022-01-14 at 13.31.59.png

build.gradle

以下を追記してインストール。

compileOnly 'org.projectlombok:lombok:1.18.20'
annotationProcessor 'org.projectlombok:lombok:1.18.20'

以上

参考

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