Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Logback but Log4j started displaying WARN no Appenders

I am using logback for my logging and it has been working however; the other day I started getting a warning

log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectResourceBundle). log4j:WARN Please initialize the log4j system properly.

I am not using log4j nor have I ever with this project. I have a logback.xml in my resources folder.

Any ideas on why this warning started to show up?

like image 720
Chris Watts Avatar asked Jan 14 '13 19:01

Chris Watts


People also ask

Is Logback affected by log4j?

It brings indeed log4j-api but does not bring log4j-core so our starter is not affected by this vulnerability.

Does spring boot use Logback instead of log4j?

Spring Boot by default using Logback for its logging. There is no need for adding it explicitly: By default, If you use the 'Starter POMs', Logback will be used for logging.

Is Logback different from log4j?

1. As logback is improved, version log4j and versions log4j2 and logback have no difference in terms of performance or any features. Therefore log4j is the most used logging utility before the logback newer versions were invented.


1 Answers

You must be using a library that does use log4j. Can you post anything more about your project?

You should probably just put log4j bridge on the classpath. Read more here: http://www.slf4j.org/legacy.html

The jar you want to look into is log4j-over-slf4j. It will bridge log4j API to actually make calls to your implementation of slf4j API (in your case - logback).

If you are using Maven to build your project then it might be as simple as putting

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>log4j-over-slf4j</artifactId>
    <version>1.7.7</version>
</dependency>

in dependencies.

Excluding a library (if needed) would be done in this fashion (this assumes we are talking about the transitive dependency from the jar you've mentioned):

    <dependency>
        <groupId>org.swift.common</groupId>
        <artifactId>jira-soap</artifactId>
        <version>4.4.0</version>
        <exclusions>
            <exclusion>
                <groupId>...</groupId>
                <artifactId>...</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
like image 167
theadam Avatar answered Sep 29 '22 12:09

theadam