[ 
https://issues.apache.org/jira/browse/LOG4J2-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17479021#comment-17479021
 ] 

Ralph Goers edited comment on LOG4J2-3353 at 1/19/22, 11:21 PM:
----------------------------------------------------------------

The additivity property is meaningless on the Root logger.  See 
[https://logging.apache.org/log4j/2.x/manual/configuration.html#Additivity.]  
When additivity is true then events that were handled by a particular logger 
will also be delegated to its parents. The root logger has no parents. 

I have copied the rest of the answer from Stackoverflow here.

Out of the box, Log4j 1 does not support configuration via Groovy. From what I 
can tell you are providing a basic log4j 1.x configuration and then the Groovy 
tools is modifying that configuration. I can't be sure what all of the syntax 
means without looking at the tools documentation. However, it seems pretty 
clear that the lines doing
{code:java}
 error 'org.codehaus.groovy.grails.web.servlet',  //  controllers
  'org.codehaus.groovy.grails.web.pages', //  GSP
  'org.codehaus.groovy.grails.web.sitemesh', //  layouts
  'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping
  'org.codehaus.groovy.grails.web.mapping', // URL mapping
  'org.codehaus.groovy.grails.commons', // core / classloading
  'org.codehaus.groovy.grails.plugins', // plugins
  'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
  'org.springframework',
  'org.hibernate' {code}
are declaring individual loggers at the error level.

So you would need to add lines to your configuration such as
{code:java}
logger.hibernate.name = org.hibernate
logger.hibernate.level = error{code}
to match what your Groovy code is doing. If you do not specify the additivity 
it will default to true and the message will be routed to the appender 
associated with the root logger.


was (Author: [email protected]):
The additivity property is meaningless on the Root logger.  See 
[https://logging.apache.org/log4j/2.x/manual/configuration.html#Additivity.]  
When additivity is true then events that were handled by a particular logger 
will also be delegated to its parents. The root logger has no parents. 

I have copied the rest of the answer from Stackoverflow here.

Out of the box, Log4j 1 does not support configuration via Groovy. From what I 
can tell you are providing a basic log4j 1.x configuration and then the Groovy 
tools is modifying that configuration. I can't be sure what all of the syntax 
means without looking at the tools documentation. However, it seems pretty 
clear that the lines doing
{code:java}
 error 'org.codehaus.groovy.grails.web.servlet',  //  controllers
  'org.codehaus.groovy.grails.web.pages', //  GSP
  'org.codehaus.groovy.grails.web.sitemesh', //  layouts
  'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping
  'org.codehaus.groovy.grails.web.mapping', // URL mapping
  'org.codehaus.groovy.grails.commons', // core / classloading
  'org.codehaus.groovy.grails.plugins', // plugins
  'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration
  'org.springframework',
  'org.hibernate' {code}
are declaring individual loggers at the error level.

So you would need to add lines to your configuration such as
{code:java}
logger.org.hibernate.level=error{code}

to match what your Groovy code is doing.

> Additive property always set to true
> ------------------------------------
>
>                 Key: LOG4J2-3353
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3353
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core, Log4j 1.2 bridge
>    Affects Versions: 2.17.1
>         Environment: 
> [stackoverflow|https://stackoverflow.com/questions/70741835/internal-grails-logs-appearing-after-log4j2-upgrade]
>            Reporter: Jitin Dominic
>            Priority: Major
>
> During upgrading log4j2 in grails 2.5.4 application, I removed all log4j 
> 1.2.17 dependencies and added following dependencies pertaining to v2.17.1:
>  * log4j-api
>  * log4j-core
>  * log4j-1.2-api
>  * log4j-slf4j-impl
>  
> Here's my _log4j2.properties_ file present under conf directory:
> {code:java}
> rootLogger.level = INFO
> rootLogger.additivity = false
> rootLogger.appenderRefs = stdout
> rootLogger.appenderRef.stdout.ref = STDOUT
> appender.console.type = Console
> appender.console.name = STDOUT
> appender.console.layout.type = PatternLayout
> appender.console.layout.pattern = %m%n
>  {code}
>  
> I noticed that internal framework logs were also appearing and on further 
> debugging I found that the additivity property for root logger was set to 
> true (even when it is set to _false_ in properties file). 
>  
> I've posted a question with further details on 
> [stackoverflow|https://stackoverflow.com/questions/70741835/internal-grails-logs-appearing-after-log4j2-upgrade].



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to