Geode code directly uses both 1) log4j-api:2.1 and 2) log4j-core:2.1. #1 is
required for Geode classes' use of log4j2 loggers. #2 is required for two
custom appenders that provide Alerting (in management & monitoring) and
LogWriter logging (log file rolling etc controlled by gemfire.log-file,
gemfire.log-file-size-limit, gemfire.log-disk-space-limit which was too
unique to replace with RollingFileAppender and maintain identical behavior
for backwards compatibility).

log4j-slf4j-impl:2.1 is a Geode dependency for Geode's use of Jetty which
uses SLF4J loggers. The requirement was for all Geode components (including
Pulse and REST API which use Jetty) to log to the Geode logging system and
be controllable via the gemfire.log-level and other logging configuration
properties.

By default gemfire.log-level controls the log level for everything in the
Geode JVM. If you set log-level=debug then everything will be at debug
level starting at the root logger level. Again, this was for backwards
compatibility (log-level previously controlled log level for the entire
JVM). If you require finer grained control over logging, then you would
need to use a log4j2.xml and/or exclude specific log4j2 jars.

If you don't want to use a log4j2.xml and you really don't want
gemfire.log-level to control root logger, then another option is to the set
System Property "gemfire.logging.appenders.LOGGER" to some value other than
"" (which is root logger and the default). For example,
"-Dgemfire.logging.appenders.LOGGER=com.gemstone" would result in
gemfire.log-level only controlling the log-level for com.gemstone* loggers.

All of the logging related code is in com.gemstone.gemfire.internal.logging
and com.gemstone.gemfire.internal.logging.log4j if you want to read through
any of it for deeper insight into what, how, & why. Please feel free to ask
further questions!

-Kirk


On Wed, Jul 15, 2015 at 8:07 AM, John Blum <[email protected]> wrote:

> Off the top of my head, 1 way would be to do the following (I think :-)...
>
> compile
> ("org.springframework.data:spring-data-gemfire:1.7.0.APACHE-GEODE-EA-SNAPSHOT")
> {
>     exclude module : 'org.apache.geode:gemfire-core'
> }
>
> compile ("org.apache.geode:gemfire-core:1.0.0-incubating-SNAPSHOT") {
>     exclude module : 'org.apache.logging.log4j:log4j-slf4j-impl'
> }
>
>
> So, for the SDG dependency, you shouldn't need to exclude any of the other
> Geode deps (a.k.a. modules, e.g. gemfire-jgroups, etc because they don't
> declare
> <https://repository.apache.org/content/repositories/snapshots/org/apache/geode/gemfire-jgroups/1.0.0-incubating-SNAPSHOT/gemfire-jgroups-1.0.0-incubating-20150715.080727-26.pom>
>  [0]
> a SLF4J dependency binding), just gemfire-core, which is the module that pulls
> in the SLF4J binding
> <https://repository.apache.org/content/repositories/snapshots/org/apache/geode/gemfire-core/1.0.0-incubating-SNAPSHOT/gemfire-core-1.0.0-incubating-20150715.080719-27.pom>(s)
> [1].  Then you "explicitly" declare gemfire-core dependency (because you
> need it) with the SLF4J binding exclusion.
>
> Give that a try.
>
> Cheers,
> John
>
> [0] -
> https://repository.apache.org/content/repositories/snapshots/org/apache/geode/gemfire-jgroups/1.0.0-incubating-SNAPSHOT/gemfire-jgroups-1.0.0-incubating-20150715.080727-26.pom
>
> [1] -
> https://repository.apache.org/content/repositories/snapshots/org/apache/geode/gemfire-core/1.0.0-incubating-SNAPSHOT/gemfire-core-1.0.0-incubating-20150715.080719-27.pom
>
> On Tue, Jul 14, 2015 at 10:45 PM, João Peixoto <[email protected]>
> wrote:
>
>> When trying to run different components I'm getting the warning message:
>>
>> SLF4J: Class path contains multiple SLF4J bindings.
>>
>> Even if I try to exclude them, say:
>>
>> compile
>> ("org.springframework.data:spring-data-gemfire:1.7.0.APACHE-GEODE-EA-SNAPSHOT")
>> {
>>         exclude module : 'spring-boot-starter-logging'
>>         exclude module : "org.apache.logging.log4j:log4j-slf4j-impl:2.1"
>>     }
>>
>> It does nothing. Doing "gradle dependencies" tells me it is geode pulling
>> those bindings.
>>
>> This causes ALL logging to be in debug level, which is way too noisy.
>> Any idea how to circumvent this?
>>
>> Joao Peixoto
>>
>
>
>
> --
> -John
> 503-504-8657
> john.blum10101 (skype)
>

Reply via email to