20
14

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.

Javaでslf4j使うときに出たよくわからんエラーの解消法

Last updated at Posted at 2017-06-30

バッチはログが命ということで、
Slf4jつかいたいなーと思いzipダウンロード。
https://www.slf4j.org/download.html

外部jar追加から
slf4j-api-1.7.25.jar だけ追加して、javaに

@Slf4j
public class HogeMain {
  public static void main(String args[]){
     ...
     log.info("testosterone");
     ...
  }

と書いて実行したら、以下エラー

   SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
   SLF4J: Defaulting to no-operation (NOP) logger implementation
   SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

slf4j-simple-1.7.25.jar も追加すると直るよ。

ちなみにこのエラーがでるときは、不必要なjarを追加してると思われる。

NoClassDefFoundError: android/util/Log

slf4j-api-1.7.25.jar
slf4j-simple-1.7.25.jar
ただjavaにログ出したいだけならこの2つのjarだけでとりあえず動いた

20
14
1

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
20
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?