0
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for 
more info.

I am a noob in dropwizard microservices building. Getting this warning when running my dropwizard application without SLF4j and i don't know where the logs are generated.

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>${slf4j-log4j12}</version>
        </dependency>

when I include this in my pom file i get this warning:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in         
[jar:file:/Users/Deadpool/.m2/repository/ch/qos/logback/logback- 
classic/1.2.3/logback-classic- 
1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in 
[jar:file:/Users/Deadpool/.m2/repository/org/slf4j/slf4j- 
log4j12/1.7.25/slf4j-log4j12- 
1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an 
explanation.
SLF4J: Actual binding is of type 
[ch.qos.logback.classic.util.ContextSelectorStaticBinder]
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for 
more info.

My real problem is how can i use Slf4j to log in a file and also to console. I also had log4j.yaml file in my src/main/resources folder.

Configuration:
 status: INFO
 monitorInterval: "5"


Appenders:
 RollingFile:
  - name: fkbossaLog
    bufferedIO: true
    immediateFlush: true
    fileName: /tmp/fkbossa.log
    filePattern: fkbossa-%d{yyyy-MM-dd-HH}-%i.log.gz
    PatternLayout:
      Pattern: '%highlight{%-5level}{STYLE=Logback} [%d{ISO8601}] [%t] %logger{36}.%M(%F:%L): %msg%n'
    Policies:
      SizeBasedTriggeringPolicy:
        size: "20 MB"
    DefaultRollOverStrategy:
      max: 5
 Console:
  - name: console
    PatternLayout:
      Pattern: '%highlight{%-5level}{STYLE=Logback} [%d{ISO8601}] [%t] %c [%X{RequestTrackerId}]: %msg%n'

Loggers:
 Root:
  level: info
  AppenderRef:
    - ref: console
 logger:
  -
    name: org.hibernate
    level: error
    additivity: false
  -
    name: org.eclipse.jetty
    level: info

I also have lombok and dropwizard-logging and i don't know which logging framework is it using for logging

Deadpool
  • 94
  • 10

1 Answers1

1
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for 
more info.

This warning persisted because your application does not know which logging provider to use for the hibernate errors. For setting this, you have to include `

static {
    System.setProperty("org.jboss.logging.provider", "slf4j");
}

in your MainApplication.This will set jboss logging provider as slf4j(which i am using as a logging framework.

Multiple bindings slf4j warning occurred because of multiple slf4j-api dependencies are available in the class path. so u can resolve it by excluding any one which you don't want.

Your log file will be in your tmp folder (mac) or var/log/tmp folder(debian dist)

Deadpool
  • 94
  • 10