1

This is a common issue I have faced. In a Java project, unfortunately, sometimes there are multiple Log providers like logback, java.util.Logger (always there), Log4j etc. Sometimes there are multiple jars of same logger with different version. I need to know which provider + version exactly is actually being used at runtime. I am using SLF4J API as an abstraction. Any idea how to?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Apurva Singh
  • 4,534
  • 4
  • 33
  • 42
  • 1
    Similar to https://stackoverflow.com/questions/950642/how-to-analyse-which-jar-file-is-used-in-a-java-program – Richard Fearn Sep 26 '18 at 20:54
  • 2
    First question: Which logging API are you using? It is the API wrappers that forward to the actual logging implementation, so you have to analyze the API to figure out where logging is directed. – Andreas Sep 26 '18 at 20:57
  • @RichardFearn: I'd argue that the two are radically divergent. Certain higher-order logging libraries (like Log4J2 and SLF4J) are designed to play nice with one another, such that it shouldn't matter which log is coming from where. – Makoto Sep 26 '18 at 21:03
  • 1
    There should be an easier way as compared to -verbose:class – Apurva Singh Sep 26 '18 at 21:03
  • 1
    If your project is built with `Maven`, a `mvn dependency:tree` might help you. You will see, one, maybe two or three differents _groupId:artifactId:version_ of loggers. It will give you more clues about which one has the most chances to be the one used. – Marc Le Bihan Sep 27 '18 at 11:28

1 Answers1

-1

Build.gradle file you can get log name an version

nik
  • 1