logzio / logzio-logback-appender

Logback Appender that ships logs using HTTPs bulk
Apache License 2.0
25 stars 19 forks source link

SLF4J: A number (2) of logging calls during the initialization phase have been intercepted #19

Closed timgilbert closed 7 years ago

timgilbert commented 7 years ago

Hi! I'm using logzio-logback-appender "1.0.9" with ch.qos.logback/logback-classic "1.1.7" in a Clojure project running on Java 1.8.0_45. Everything seems to work well for the most part, but I am seeing a lot of the following blocks of code written to stdout when I start my application:

SLF4J: A number (2) of logging calls during the initialization phase have been intercepted and are
SLF4J: now being replayed. These are subject to the filtering rules of the underlying logging system.
SLF4J: See also http://www.slf4j.org/codes.html#replay

This seems to happen regardless of whether I'm actually using the logz.io appender that is defined in my logback.xml file, so I suspect that there is some kind of logging happening early on during the appender initialization, but I'll be darned if I can find it.

The app in question is sometimes used to generate output to stdout which is then consumed by other software during the build process and the like, so this behavior messes things up for us a bit. Anyways, I was hoping someone could reproduce this and/or develop a fix for it.

roiravhon commented 7 years ago

Hey @timgilbert! After digging through slf4j's code, this is the conclusion we came to:

When our appender starts, it initiates a new instance of the persistent queue library that we are using (Bigqueue) which uses slf4j logging. The issue is that when Bigqueue writes logs, the logging pipeline is not up yet, therefore it is queued - and when it's up it replays the logs (which produce the message you see)

Unfortunately, there is no way to disable those as slf4j is printing it directly to stderr.

What I can recommend as a workaround, is to redirect stderr to /dev/null, so you will just get your application's output.

Sorry for having no better solution

uptimestar commented 6 years ago

I have the same error. Using log4j v1.2.x

asafm commented 6 years ago

@uptimestar - We've deprecated log4j 1.x appender as log4j 1.x as reached EOL.

cekvenich commented 6 years ago

Luckily, source is in maven. It is the only one that works. Log4jv2 does not work in jar - known issue. Logback forces xml, can't use properties. We migrated from maven to grade to be more modern. My finding is that the only logger that works with logz.io is log4j v1. Sad that you deprecated it - I need a pure java central logger.

asafm commented 6 years ago

Please help us understand the problem- we will try to help as we can. Describe the problem or share links to it On Sun, 21 Jan 2018 at 18:33 cekvenich notifications@github.com wrote:

Luckily, source is in maven. It is the only one that works. Log4jv2 does not work in jar - known issue. Logback forces xml, can't use properties. We migrated from maven to grade to be more modern. My finding is that the only logger that works with logz.io is log4j v1. Sad that you deprecated it - I need a pure java central logger.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/logzio/logzio-logback-appender/issues/19#issuecomment-359261080, or mute the thread https://github.com/notifications/unsubscribe-auth/AA8Y8dEWmbjOuGw05ihAdm7gYo0jUSgKks5tM2bPgaJpZM4KrqDm .

techhemant commented 5 years ago

Replace slf4j-api dependency with following. I don't see the message anymore.

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