• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

How to know the real log framework using behind SLF4J

 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From the documentation

The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logging frameworks (e.g. java.util.logging, logback, log4j) allowing the end user to plug in the desired logging framework at deployment time.



Given the source code


and the following pom.xml



How to know which logging framework is really used?
I see only artifactId slf4j-jobss-logging has no scope = compile, so in runtime, it should be using slf4j-jboss-logging?

But then I google and see JBoss Logging is also just a "logging bridge"
https://docs.jboss.org/hibernate/orm/4.3/topical/html/logging/Logging.html

And in this site has following

JBoss Logging understands the following back-ends as first-class citizens:

JBoss LogManager (mainly used only inside the WildFly app server)

Log4j 2

Log4j 1

Slf4j

JDK logging



And in my log, I see the logger class has more than one class as

"loggerClassName":"org.apache.commons.logging.impl.JBossLog"
"loggerClassName":"org.slf4j.impl.Slf4jLogger"
"loggerClassName":"io.undertow.UndertowLogger_$logger"



So what is the real logging implementation is using?






 
Saloon Keeper
Posts: 29002
214
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this may help: https://www.slf4j.org/manual.html

Your target logger is the "provider" class you include, formerly known as the "binding".
 
Tim Holloway
Saloon Keeper
Posts: 29002
214
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, yeah One other thing. JEE server loggers tend to log only log messages from the server itself. If a webapp wants a logger, it has to define its own, on a per-application basis. Meaning one app might log using JULI, another Log4jJ, another also Log4J but with its own distinct logfiles and so forth.

Took me a while to find that out.
 
Grow a forest with seedballs and this tiny ad:
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic