In order to get Log4J 2 API to log to LogBack, you need to add log4j-slf4j-impl-2.x.jar (Log4j 2 to SLF4J Adapter) to your classpath [1]. Performance of Apache Geode will be noticeably reduced but I don't have any numbers to share at this time.
The following Geode product classes (all in geode-core) directly import and use classes from Log4J 2 Core to implement custom Appenders: org.apache.geode.internal.logging.log4j.AlertAppender.java org.apache.geode.internal.logging.log4j.AppenderContext org.apache.geode.internal.logging.log4j.ConfigLocator.java org.apache.geode.internal.logging.log4j.Configurator.java org.apache.geode.internal.logging.log4j.LogWriterAppender.java org.apache.geode.internal.logging.log4j.ThreadIdPatternConverter.java org.apache.geode.internal.logging.LogService The above dependencies on Log4J 2 Core are not currently optional, nor is there currently a Geode Logging SPI to facilitate reimplementing the AlertAppender or LogWriterAppender with an alternative logging impl such as LogBack. But I think using log4j-slf4j-impl-2.x.jar should hopefully result in Geode log message going to SLF4J/LogBack if that's what you need. [1] https://logging.apache.org/log4j/2.x/log4j-to-slf4j/index.html -Kirk On Tue, Dec 6, 2016 at 9:20 AM, Dharam Thacker <[email protected]> wrote: > Yeah but this bridge is only for log4j 1.x which uses org.apache.log4j vs > log4j 2.x which uses org.apache.logging.log4j packages. > > > Geode also uses apache logging log4j which is log4j2. > > > Regards, > Dharam > > > On Dec 6, 2016 22:37, "Jared Stewart" <[email protected]> wrote: > > Hi Dharam, > > In general this may be possible by excluding log4j from your classpath and > instead bringing in the log4j-over-slf4j module ( > http://www.slf4j.org/legacy.html#log4j-over-slf4j). However, this bridge > does not support log4j appenders or filters - and I believe that Geode does > make use of those features. > > On Dec 5, 2016, at 9:18 PM, Dharam Thacker <[email protected]> > wrote: > > Hi Team, > > We have a common logback thread based logging configuration across all > distributed application components. > > We use slf4j abstraction for all our logging needs. > > Geode internally uses Apache log4j 2 implementation. Is there any way, I > can route log4j messages so that it also goes via slf4j and internally > logback? > > Thanks & Regards, > - Dharam Thacker > > > >
