Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLF4J bridge for LOG4J2 causing problems with apache HttpClient #160

Open
AndreG-P opened this issue Jan 8, 2018 · 0 comments
Open

SLF4J bridge for LOG4J2 causing problems with apache HttpClient #160

AndreG-P opened this issue Jan 8, 2018 · 0 comments

Comments

@AndreG-P
Copy link
Member

AndreG-P commented Jan 8, 2018

So I changed, all loggings to log4j2. Essentially by adding 2 dependencies:

        <!-- Logging via log4j2 -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.10.0</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.10.0</version>
        </dependency>

Since some other dependencies (for example flink) using log4j (not log4j2) we need to import the bridge.

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-1.2-api</artifactId>
            <version>2.10.0</version>
        </dependency>

Everything works fine but, why ever, it looks like flink uses slf4j for logging, just at the startup. Fine, let's add a bridge for slf4j also:

        <dependency> <!-- Redirect all slf4j logging to log4j2 -->
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>2.10.0</version>
        </dependency>

Now the error in the beginning (cannot ).
BUT! Suddenly, the caching HttpClient gets an error:

org.apache.http.impl.execchain.RequestAbortedException: Request aborted
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:194)
	at org.apache.http.impl.client.cache.CachingExec.callBackend(CachingExec.java:592)
	at org.apache.http.impl.client.cache.CachingExec.execute(CachingExec.java:269)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
	at com.formulasearchengine.mathosphere.mlp.text.TexInfo.makeRequest(TexInfo.java:81)
	at com.formulasearchengine.mathosphere.mlp.text.TexInfo.getIdentifiers(TexInfo.java:108)
        ...

Removing the logging bridge for slf4j solves this error, but produces a warning in the beginning.

AndreG-P added a commit that referenced this issue Jan 8, 2018
physikerwelt pushed a commit that referenced this issue Jan 8, 2018
* Change loglevel to INFO

* Redirect SLF4J to log4j2

Fix logging problems with slf4j

* Change in loglevel to INFO in src/main logging

* Take out SLF4J bridge (see #160)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant