Closed adrianbader closed 7 years ago
Hmm, it is strange. I use Log4J2. The log4j2.xml looks now as attached. (-> renamed it to .txt here because .xml is not accepted).
<Loggers>
<Logger name="net.rubyeye.xmemcached.transcoders.BaseSerializingTranscoder" level="OFF"
additivity="false">
<Appender-ref ref="ConsoleAppender" level="OFF" />
</Logger>
<Root level="INFO">
<AppenderRef ref="DatabaseAppender"/>
<AppenderRef ref="ConsoleAppender"/>
</Root>
</Loggers>
But BaseSerializingTranscoder does still log errors. The following test shows the problem:
org.slf4j.Logger logger1 = LoggerFactory.getLogger(BaseSerializingTranscoder.class);
logger1.error("log test the same was as in memcachedclient");
org.apache.logging.log4j.Logger logger2 = LogManager.getLogger(BaseSerializingTranscoder.class);
logger2.error("log test with log4j ");
This outputs the first error. Doesn't this show that slf4j (as you use) does ignore my whole Log4j config? What can I do?
I am sorry ,i am not familiar with log4j configuration. Maybe you can ask the question on stackoverflow.
Maybe you can try change OFF
to lowercase off
.
Thanks for your tipp. I already placed a question: https://stackoverflow.com/questions/46365134/slf4j-in-library-seems-to-ignore-my-log4j2-configuration
It seems to become hard...
One possibility to solve this is, if you would implement a method on memcachedclient to disable logging at all and depending on this, do no more logging. :)
Of course i can ,but i think disabling log4j package level logging is a better choice.
2017-09-22 21:57 GMT+08:00 adrianbader notifications@github.com:
Thanks for your tipp. I already placed a question: https://stackoverflow.com/questions/46365134/slf4j-in- library-seems-to-ignore-my-log4j2-configuration
It seems to become hard...
One possibility to solve this is, if you would implement a method on memcachedclient to disable logging at all and depending on this, do no more logging. :)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/killme2008/xmemcached/issues/63#issuecomment-331454175, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA3Pm-iYr3Q3xnnQvZTY3NDt7_6ijjyks5sk7zAgaJpZM4PgYxk .
-- 庄晓丹 Email: killme2008@gmail.com Site: http://fnil.net
不学习,毋宁死
With the help of Stackoverflow [https://stackoverflow.com/q/46365134/4106030] I was able to get a solution. The problem was that Wildfly includes implizitely log4j -> so over slf4J, this log4j with its config was taken; therefore, the own config has been ignored.
If a retrieved object from cache is no more "compatible" with the current class in the running application, memcachedClient.get(..) does correctly return null but also prints an exeption trace like:
There is no exception thrown to my code so that I could catch it around memcachedClient.get(..). This output comes from the client itself. How can I disable this?
I already have the following in my
log4j.xml
Configuration:Edit: fixed styling.