[jira] [Closed] (LOG4J2-3426) Log4j 1.x bridge Logger.getAppender returns a wrapped AppenderAdapter

2022-03-07 Thread Pooja Pandey (Jira)


 [ 
https://issues.apache.org/jira/browse/LOG4J2-3426?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pooja Pandey closed LOG4J2-3426.


Issue is fixed.

> Log4j 1.x bridge Logger.getAppender returns a wrapped AppenderAdapter
> -
>
> Key: LOG4J2-3426
> URL: https://issues.apache.org/jira/browse/LOG4J2-3426
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Log4j 1.2 bridge
>Affects Versions: 2.17.2
>Reporter: Pooja Pandey
>Assignee: Piotr Karwasz
>Priority: Major
> Fix For: 2.17.3
>
>
> In our code, we have a custom logger and a custom multiprocess rolling 
> FileAppender as below shown in below code snippet.
>  
> For some processing, we need to get appender from logger, so we call 
> Logger.getAppender() but with log4j1.x bridge it is returning AppenderWrapper 
> unlike log4j1.x where we used to get an Appender.
>  
> We need to typecast returned value to FileAppender but since now it 
> AppenderWrapper, so it is throwing exception "java.lang.ClassCastException: 
> org.apache.log4j.bridge.AppenderWrapper cannot be cast to 
> org.apache.log4j.FileAppender".
> To fix cast exception we are overriding getAppender in our customLogger as 
> shown below, however we are still having some minor issues in reading 
> property value but may be this new issue is due to some other problems. I am 
> still trying to figure out.
> I am creating this Jira ticket with a hope that if there is a possibility 
> then may be log4j1.x bridge can be modified to provide this conversion 
> instead we override this method in our custom logger.
> @Override    public Appender getAppender(final String name) \{        
> AppenderWrapper appenderWrapper = (AppenderWrapper) super.getAppender(name);  
>       return 
> ((AppenderAdapter.Adapter)appenderWrapper.getAppender()).getAppender();    }
>  
> public class CustomLogger extends Logger implements java.io.Serializable {}
>  
> public class CustomMultiProcessRollingAppender extends FileAppender \{ }



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


[jira] [Commented] (LOG4J2-3426) Log4j 1.x bridge Logger.getAppender returns a wrapped AppenderAdapter

2022-03-07 Thread Pooja Pandey (Jira)


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

Pooja Pandey commented on LOG4J2-3426:
--

[~pkarwasz],

 

This fixes the issue, thank you so much. Closing the issue. Any idea when 
2.17.3 would be released??

 

> Log4j 1.x bridge Logger.getAppender returns a wrapped AppenderAdapter
> -
>
> Key: LOG4J2-3426
> URL: https://issues.apache.org/jira/browse/LOG4J2-3426
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Log4j 1.2 bridge
>Affects Versions: 2.17.2
>Reporter: Pooja Pandey
>Assignee: Piotr Karwasz
>Priority: Major
> Fix For: 2.17.3
>
>
> In our code, we have a custom logger and a custom multiprocess rolling 
> FileAppender as below shown in below code snippet.
>  
> For some processing, we need to get appender from logger, so we call 
> Logger.getAppender() but with log4j1.x bridge it is returning AppenderWrapper 
> unlike log4j1.x where we used to get an Appender.
>  
> We need to typecast returned value to FileAppender but since now it 
> AppenderWrapper, so it is throwing exception "java.lang.ClassCastException: 
> org.apache.log4j.bridge.AppenderWrapper cannot be cast to 
> org.apache.log4j.FileAppender".
> To fix cast exception we are overriding getAppender in our customLogger as 
> shown below, however we are still having some minor issues in reading 
> property value but may be this new issue is due to some other problems. I am 
> still trying to figure out.
> I am creating this Jira ticket with a hope that if there is a possibility 
> then may be log4j1.x bridge can be modified to provide this conversion 
> instead we override this method in our custom logger.
> @Override    public Appender getAppender(final String name) \{        
> AppenderWrapper appenderWrapper = (AppenderWrapper) super.getAppender(name);  
>       return 
> ((AppenderAdapter.Adapter)appenderWrapper.getAppender()).getAppender();    }
>  
> public class CustomLogger extends Logger implements java.io.Serializable {}
>  
> public class CustomMultiProcessRollingAppender extends FileAppender \{ }



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


[GitHub] [logging-log4j2] jvz commented on pull request #744: [LOG4J2-2803] Create standardized dependency injection API

2022-03-07 Thread GitBox


jvz commented on pull request #744:
URL: https://github.com/apache/logging-log4j2/pull/744#issuecomment-1061403755


   I'd like to merge this sometime within the next couple weeks unless there 
are some issues raised.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[jira] [Commented] (LOG4J2-3428) Update 3rd party dependencies for 2.17.3

2022-03-07 Thread ASF subversion and git services (Jira)


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

ASF subversion and git services commented on LOG4J2-3428:
-

Commit 11c6e65e5b22cfcf1cb07a554f147bcd5ee9e604 in logging-log4j2's branch 
refs/heads/dependabot/maven/slf4jVersion-1.7.36 from Gary Gregory
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=11c6e65 ]

[LOG4J2-3428] Update 3rd party dependencies for 2.17.3

* com.fasterxml.jackson.core:jackson-annotations 2.13.1 -> 2.13.2
* com.fasterxml.jackson.core:jackson-core 2.13.1 -> 2.13.2
* com.fasterxml.jackson.core:jackson-databind 2.13.1 -> 2.13.2
* com.fasterxml.jackson.dataformat:jackson-dataformat-xml 2.13.1 ->
2.13.2
* com.fasterxml.jackson.dataformat:jackson-dataformat-yaml 2.13.1 ->
2.13.2
* com.fasterxml.jackson.module:jackson-module-jaxb-annotations 2.13.1 ->
2.13.2
* com.google.guava:guava-testlib 31.0.1-jre -> 31.1-jre
* de.flapdoodle.embed:de.flapdoodle.embed.mongo 3.4.1 -> 3.4.3
* org.awaitility:awaitility 4.1.1 -> 4.2.0
* org.codehaus.groovy:groovy-dateutil 3.0.9 -> 3.0.10
* org.codehaus.groovy:groovy-jsr223 3.0.9 -> 3.0.10
* org.springframework:spring-aop 5.3.15 -> 5.3.16
* org.springframework:spring-beans 5.3.15 -> 5.3.16
* org.springframework:spring-context 5.3.15 -> 5.3.16
* org.springframework:spring-context-support 5.3.15 -> 5.3.16
* org.springframework:spring-core 5.3.15 -> 5.3.16
* org.springframework:spring-expression 5.3.15 -> 5.3.16
* org.springframework:spring-oxm 5.3.15 -> 5.3.16
* org.springframework:spring-test 5.3.15 -> 5.3.16
* org.springframework:spring-web 5.3.15 -> 5.3.16
* org.springframework:spring-webmvc 5.3.15 -> 5.3.16


> Update 3rd party dependencies for 2.17.3
> 
>
> Key: LOG4J2-3428
> URL: https://issues.apache.org/jira/browse/LOG4J2-3428
> Project: Log4j 2
>  Issue Type: Task
>  Components: Build
>Reporter: Gary D. Gregory
>Priority: Major
> Fix For: 2.17.3
>
>
> This ticket should only be closed when we release 2.17.3.
> The updated dependencies are:
> * com.fasterxml.jackson.core:jackson-annotations 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.core:jackson-core 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.core:jackson-databind 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.dataformat:jackson-dataformat-xml 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.dataformat:jackson-dataformat-yaml 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.module:jackson-module-jaxb-annotations 2.13.1 -> 
> 2.13.2
> * com.google.guava:guava-testlib 31.0.1-jre -> 31.1-jre
> * de.flapdoodle.embed:de.flapdoodle.embed.mongo 3.4.1 -> 3.4.3
> * org.awaitility:awaitility 4.1.1 -> 4.2.0
> * org.codehaus.groovy:groovy-dateutil 3.0.9 -> 3.0.10
> * org.codehaus.groovy:groovy-jsr223 3.0.9 -> 3.0.10
> * org.springframework:spring-aop 5.3.15 -> 5.3.16
> * org.springframework:spring-beans 5.3.15 -> 5.3.16
> * org.springframework:spring-context 5.3.15 -> 5.3.16
> * org.springframework:spring-context-support 5.3.15 -> 5.3.16
> * org.springframework:spring-core 5.3.15 -> 5.3.16
> * org.springframework:spring-expression 5.3.15 -> 5.3.16
> * org.springframework:spring-oxm 5.3.15 -> 5.3.16
> * org.springframework:spring-test 5.3.15 -> 5.3.16
> * org.springframework:spring-web 5.3.15 -> 5.3.16
> * org.springframework:spring-webmvc 5.3.15 -> 5.3.16



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


[jira] [Commented] (LOG4J2-3424) JDBC Appender configuration properties not handled correctly after upgrading to 2.17.2

2022-03-07 Thread ASF subversion and git services (Jira)


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

ASF subversion and git services commented on LOG4J2-3424:
-

Commit 4492c26f72ce5aa7e28c96242065a472b17a882f in logging-log4j2's branch 
refs/heads/dependabot/maven/slf4jVersion-1.7.36 from Carter Kozak
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=4492c26 ]

LOG4J2-3424: Correctly handle property attribute values

This fixes handling of properties in .properties configurations
as well as those defined using ``
which are parsed slightly differently from those which use the
`value` syntax.


> JDBC Appender configuration properties not handled correctly after upgrading 
> to 2.17.2
> --
>
> Key: LOG4J2-3424
> URL: https://issues.apache.org/jira/browse/LOG4J2-3424
> Project: Log4j 2
>  Issue Type: Dependency upgrade
>  Components: Appenders, Configuration
>Affects Versions: 2.17.2
>Reporter: Grzegorz Grzybek
>Assignee: Carter Kozak
>Priority: Major
> Fix For: 2.17.3
>
>
> I'm a maintainer of Pax Logging project and for long time we had this 
> configuration in integration tests:
> {noformat}
> appender.jdbc.type = JDBC
> appender.jdbc.name = jdbc
> appender.jdbc.tableName = LOG
> appender.jdbc.connectionSource.type = DriverManager
> appender.jdbc.connectionSource.driverClassName = org.h2.Driver
> appender.jdbc.connectionSource.connectionString = 
> jdbc:h2:tcp://localhost:PORT/logsdb
> appender.jdbc.connectionSource.p1.type = property
> appender.jdbc.connectionSource.p1.name = SCHEMA
> appender.jdbc.connectionSource.p1.value = logs
> appender.jdbc.connectionSource.p2.type = property
> appender.jdbc.connectionSource.p2.name = QUERY_TIMEOUT
> appender.jdbc.connectionSource.p2.value = 5000
> appender.jdbc.connectionSource.p3.type = property
> appender.jdbc.connectionSource.p3.name = user
> appender.jdbc.connectionSource.p3.value = logadmin
> appender.jdbc.connectionSource.p4.type = property
> appender.jdbc.connectionSource.p4.name = password
> appender.jdbc.connectionSource.p4.value = logpassword
> appender.jdbc.c1.type = Column
> appender.jdbc.c1.name = DATE
> appender.jdbc.c1.isEventTimestamp = true
> appender.jdbc.c2.type = Column
> appender.jdbc.c2.name = LEVEL
> appender.jdbc.c2.pattern = %level
> appender.jdbc.c2.isUnicode = false
> appender.jdbc.c3.type = Column
> appender.jdbc.c3.name = SOURCE
> appender.jdbc.c3.pattern = %logger
> appender.jdbc.c3.isUnicode = false
> appender.jdbc.c4.type = Column
> appender.jdbc.c4.name = MESSAGE
> appender.jdbc.c4.pattern = %message
> appender.jdbc.c4.isUnicode = false
> rootLogger.level = info
> rootLogger.appenderRef.console.ref = console
> logger.my.name = my.logger
> logger.my.level = trace
> logger.my.additivity = false
> logger.my.appenderRef.jdbc.ref = jdbc
> {noformat}
> now the properties are not handled correctly. For example with:
> {noformat}
> appender.jdbc.connectionSource.p1.type = property
> appender.jdbc.connectionSource.p1.name = SCHEMA
> appender.jdbc.connectionSource.p1.value = logs
> {noformat}
> I'm getting (in 
> {{org.apache.logging.log4j.core.config.plugins.util.PluginBuilder#generateParameters()}}):
> {noformat}
> createProperty(name="SCHEMA", value="logs", value="null")
> {noformat}
> call and 
> {{org.apache.logging.log4j.core.config.Property#createProperty(java.lang.String,
>  java.lang.String, java.lang.String)}} is called with:
> * SCHEMA
> * logs
> * null
> values.
> In debug logs there's:
> {noformat}
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : Building 
> Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : 
> createProperty(name="password", value="logpassword", value="null")
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : Building 
> Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : 
> createProperty(name="SCHEMA", value="logs", value="null")
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : Building 
> Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : 
> createProperty(name="user", value="logadmin", value="null")
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : Building 
> Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : 
> createProperty(name="QUERY_TIMEOUT", value="5000", value="null")
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : Building 
> Plugin[name=connectionSource, 
> class=org.apache.logging.log4j.core.appender.db.j

[jira] [Commented] (LOG4J2-3426) Log4j 1.x bridge Logger.getAppender returns a wrapped AppenderAdapter

2022-03-07 Thread ASF subversion and git services (Jira)


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

ASF subversion and git services commented on LOG4J2-3426:
-

Commit ba16485b93cde4f05e0cbb2ca564a7b6cb6d4d77 in logging-log4j2's branch 
refs/heads/dependabot/maven/slf4jVersion-1.7.36 from Piotr P. Karwasz
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=ba16485 ]

[LOG4J2-3426] Refactors wrapping code

Refactors the wrapping logic into single `wrap` or `adapt` methods to be
sure we always perform the correct logic.


> Log4j 1.x bridge Logger.getAppender returns a wrapped AppenderAdapter
> -
>
> Key: LOG4J2-3426
> URL: https://issues.apache.org/jira/browse/LOG4J2-3426
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Log4j 1.2 bridge
>Affects Versions: 2.17.2
>Reporter: Pooja Pandey
>Assignee: Piotr Karwasz
>Priority: Major
> Fix For: 2.17.3
>
>
> In our code, we have a custom logger and a custom multiprocess rolling 
> FileAppender as below shown in below code snippet.
>  
> For some processing, we need to get appender from logger, so we call 
> Logger.getAppender() but with log4j1.x bridge it is returning AppenderWrapper 
> unlike log4j1.x where we used to get an Appender.
>  
> We need to typecast returned value to FileAppender but since now it 
> AppenderWrapper, so it is throwing exception "java.lang.ClassCastException: 
> org.apache.log4j.bridge.AppenderWrapper cannot be cast to 
> org.apache.log4j.FileAppender".
> To fix cast exception we are overriding getAppender in our customLogger as 
> shown below, however we are still having some minor issues in reading 
> property value but may be this new issue is due to some other problems. I am 
> still trying to figure out.
> I am creating this Jira ticket with a hope that if there is a possibility 
> then may be log4j1.x bridge can be modified to provide this conversion 
> instead we override this method in our custom logger.
> @Override    public Appender getAppender(final String name) \{        
> AppenderWrapper appenderWrapper = (AppenderWrapper) super.getAppender(name);  
>       return 
> ((AppenderAdapter.Adapter)appenderWrapper.getAppender()).getAppender();    }
>  
> public class CustomLogger extends Logger implements java.io.Serializable {}
>  
> public class CustomMultiProcessRollingAppender extends FileAppender \{ }



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


[GitHub] [logging-log4j2] ppkarwasz commented on pull request #776: Bump slf4jVersion from 1.7.35 to 1.7.36

2022-03-07 Thread GitBox


ppkarwasz commented on pull request #776:
URL: https://github.com/apache/logging-log4j2/pull/776#issuecomment-1061241867


   @dependabot rebase


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[jira] [Resolved] (LOG4J2-3426) Log4j 1.x bridge Logger.getAppender returns a wrapped AppenderAdapter

2022-03-07 Thread Piotr Karwasz (Jira)


 [ 
https://issues.apache.org/jira/browse/LOG4J2-3426?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Piotr Karwasz resolved LOG4J2-3426.
---
Resolution: Fixed

> Log4j 1.x bridge Logger.getAppender returns a wrapped AppenderAdapter
> -
>
> Key: LOG4J2-3426
> URL: https://issues.apache.org/jira/browse/LOG4J2-3426
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Log4j 1.2 bridge
>Affects Versions: 2.17.2
>Reporter: Pooja Pandey
>Assignee: Piotr Karwasz
>Priority: Major
> Fix For: 2.17.3
>
>
> In our code, we have a custom logger and a custom multiprocess rolling 
> FileAppender as below shown in below code snippet.
>  
> For some processing, we need to get appender from logger, so we call 
> Logger.getAppender() but with log4j1.x bridge it is returning AppenderWrapper 
> unlike log4j1.x where we used to get an Appender.
>  
> We need to typecast returned value to FileAppender but since now it 
> AppenderWrapper, so it is throwing exception "java.lang.ClassCastException: 
> org.apache.log4j.bridge.AppenderWrapper cannot be cast to 
> org.apache.log4j.FileAppender".
> To fix cast exception we are overriding getAppender in our customLogger as 
> shown below, however we are still having some minor issues in reading 
> property value but may be this new issue is due to some other problems. I am 
> still trying to figure out.
> I am creating this Jira ticket with a hope that if there is a possibility 
> then may be log4j1.x bridge can be modified to provide this conversion 
> instead we override this method in our custom logger.
> @Override    public Appender getAppender(final String name) \{        
> AppenderWrapper appenderWrapper = (AppenderWrapper) super.getAppender(name);  
>       return 
> ((AppenderAdapter.Adapter)appenderWrapper.getAppender()).getAppender();    }
>  
> public class CustomLogger extends Logger implements java.io.Serializable {}
>  
> public class CustomMultiProcessRollingAppender extends FileAppender \{ }



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


[jira] [Commented] (LOG4J2-3426) Log4j 1.x bridge Logger.getAppender returns a wrapped AppenderAdapter

2022-03-07 Thread Piotr Karwasz (Jira)


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

Piotr Karwasz commented on LOG4J2-3426:
---

[~PoojaTheCoder], I uploaded a snapshot for version 2.17.3-SNAPSHOT to the 
Apache Snapshots repository ({{https://repository.apache.org/snapshots/}}).

Please check if this solves the problem and if it does close the issue.

> Log4j 1.x bridge Logger.getAppender returns a wrapped AppenderAdapter
> -
>
> Key: LOG4J2-3426
> URL: https://issues.apache.org/jira/browse/LOG4J2-3426
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Log4j 1.2 bridge
>Affects Versions: 2.17.2
>Reporter: Pooja Pandey
>Assignee: Piotr Karwasz
>Priority: Major
>
> In our code, we have a custom logger and a custom multiprocess rolling 
> FileAppender as below shown in below code snippet.
>  
> For some processing, we need to get appender from logger, so we call 
> Logger.getAppender() but with log4j1.x bridge it is returning AppenderWrapper 
> unlike log4j1.x where we used to get an Appender.
>  
> We need to typecast returned value to FileAppender but since now it 
> AppenderWrapper, so it is throwing exception "java.lang.ClassCastException: 
> org.apache.log4j.bridge.AppenderWrapper cannot be cast to 
> org.apache.log4j.FileAppender".
> To fix cast exception we are overriding getAppender in our customLogger as 
> shown below, however we are still having some minor issues in reading 
> property value but may be this new issue is due to some other problems. I am 
> still trying to figure out.
> I am creating this Jira ticket with a hope that if there is a possibility 
> then may be log4j1.x bridge can be modified to provide this conversion 
> instead we override this method in our custom logger.
> @Override    public Appender getAppender(final String name) \{        
> AppenderWrapper appenderWrapper = (AppenderWrapper) super.getAppender(name);  
>       return 
> ((AppenderAdapter.Adapter)appenderWrapper.getAppender()).getAppender();    }
>  
> public class CustomLogger extends Logger implements java.io.Serializable {}
>  
> public class CustomMultiProcessRollingAppender extends FileAppender \{ }



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


[jira] [Updated] (LOG4J2-3426) Log4j 1.x bridge Logger.getAppender returns a wrapped AppenderAdapter

2022-03-07 Thread Piotr Karwasz (Jira)


 [ 
https://issues.apache.org/jira/browse/LOG4J2-3426?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Piotr Karwasz updated LOG4J2-3426:
--
Fix Version/s: 2.17.3

> Log4j 1.x bridge Logger.getAppender returns a wrapped AppenderAdapter
> -
>
> Key: LOG4J2-3426
> URL: https://issues.apache.org/jira/browse/LOG4J2-3426
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Log4j 1.2 bridge
>Affects Versions: 2.17.2
>Reporter: Pooja Pandey
>Assignee: Piotr Karwasz
>Priority: Major
> Fix For: 2.17.3
>
>
> In our code, we have a custom logger and a custom multiprocess rolling 
> FileAppender as below shown in below code snippet.
>  
> For some processing, we need to get appender from logger, so we call 
> Logger.getAppender() but with log4j1.x bridge it is returning AppenderWrapper 
> unlike log4j1.x where we used to get an Appender.
>  
> We need to typecast returned value to FileAppender but since now it 
> AppenderWrapper, so it is throwing exception "java.lang.ClassCastException: 
> org.apache.log4j.bridge.AppenderWrapper cannot be cast to 
> org.apache.log4j.FileAppender".
> To fix cast exception we are overriding getAppender in our customLogger as 
> shown below, however we are still having some minor issues in reading 
> property value but may be this new issue is due to some other problems. I am 
> still trying to figure out.
> I am creating this Jira ticket with a hope that if there is a possibility 
> then may be log4j1.x bridge can be modified to provide this conversion 
> instead we override this method in our custom logger.
> @Override    public Appender getAppender(final String name) \{        
> AppenderWrapper appenderWrapper = (AppenderWrapper) super.getAppender(name);  
>       return 
> ((AppenderAdapter.Adapter)appenderWrapper.getAppender()).getAppender();    }
>  
> public class CustomLogger extends Logger implements java.io.Serializable {}
>  
> public class CustomMultiProcessRollingAppender extends FileAppender \{ }



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


[jira] [Commented] (LOG4J2-3426) Log4j 1.x bridge Logger.getAppender returns a wrapped AppenderAdapter

2022-03-07 Thread ASF subversion and git services (Jira)


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

ASF subversion and git services commented on LOG4J2-3426:
-

Commit ba16485b93cde4f05e0cbb2ca564a7b6cb6d4d77 in logging-log4j2's branch 
refs/heads/release-2.x from Piotr P. Karwasz
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=ba16485 ]

[LOG4J2-3426] Refactors wrapping code

Refactors the wrapping logic into single `wrap` or `adapt` methods to be
sure we always perform the correct logic.


> Log4j 1.x bridge Logger.getAppender returns a wrapped AppenderAdapter
> -
>
> Key: LOG4J2-3426
> URL: https://issues.apache.org/jira/browse/LOG4J2-3426
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Log4j 1.2 bridge
>Affects Versions: 2.17.2
>Reporter: Pooja Pandey
>Assignee: Piotr Karwasz
>Priority: Major
>
> In our code, we have a custom logger and a custom multiprocess rolling 
> FileAppender as below shown in below code snippet.
>  
> For some processing, we need to get appender from logger, so we call 
> Logger.getAppender() but with log4j1.x bridge it is returning AppenderWrapper 
> unlike log4j1.x where we used to get an Appender.
>  
> We need to typecast returned value to FileAppender but since now it 
> AppenderWrapper, so it is throwing exception "java.lang.ClassCastException: 
> org.apache.log4j.bridge.AppenderWrapper cannot be cast to 
> org.apache.log4j.FileAppender".
> To fix cast exception we are overriding getAppender in our customLogger as 
> shown below, however we are still having some minor issues in reading 
> property value but may be this new issue is due to some other problems. I am 
> still trying to figure out.
> I am creating this Jira ticket with a hope that if there is a possibility 
> then may be log4j1.x bridge can be modified to provide this conversion 
> instead we override this method in our custom logger.
> @Override    public Appender getAppender(final String name) \{        
> AppenderWrapper appenderWrapper = (AppenderWrapper) super.getAppender(name);  
>       return 
> ((AppenderAdapter.Adapter)appenderWrapper.getAppender()).getAppender();    }
>  
> public class CustomLogger extends Logger implements java.io.Serializable {}
>  
> public class CustomMultiProcessRollingAppender extends FileAppender \{ }



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


[GitHub] [logging-log4j2] ppkarwasz merged pull request #786: [LOG4J2-3426] Refactors wrapping code

2022-03-07 Thread GitBox


ppkarwasz merged pull request #786:
URL: https://github.com/apache/logging-log4j2/pull/786


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[jira] [Commented] (LOG4J2-3428) Update 3rd party dependencies for 2.17.3

2022-03-07 Thread Ralph Goers (Jira)


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

Ralph Goers commented on LOG4J2-3428:
-

Thanks for doing this.

> Update 3rd party dependencies for 2.17.3
> 
>
> Key: LOG4J2-3428
> URL: https://issues.apache.org/jira/browse/LOG4J2-3428
> Project: Log4j 2
>  Issue Type: Task
>  Components: Build
>Reporter: Gary D. Gregory
>Priority: Major
> Fix For: 2.17.3
>
>
> This ticket should only be closed when we release 2.17.3.
> The updated dependencies are:
> * com.fasterxml.jackson.core:jackson-annotations 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.core:jackson-core 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.core:jackson-databind 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.dataformat:jackson-dataformat-xml 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.dataformat:jackson-dataformat-yaml 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.module:jackson-module-jaxb-annotations 2.13.1 -> 
> 2.13.2
> * com.google.guava:guava-testlib 31.0.1-jre -> 31.1-jre
> * de.flapdoodle.embed:de.flapdoodle.embed.mongo 3.4.1 -> 3.4.3
> * org.awaitility:awaitility 4.1.1 -> 4.2.0
> * org.codehaus.groovy:groovy-dateutil 3.0.9 -> 3.0.10
> * org.codehaus.groovy:groovy-jsr223 3.0.9 -> 3.0.10
> * org.springframework:spring-aop 5.3.15 -> 5.3.16
> * org.springframework:spring-beans 5.3.15 -> 5.3.16
> * org.springframework:spring-context 5.3.15 -> 5.3.16
> * org.springframework:spring-context-support 5.3.15 -> 5.3.16
> * org.springframework:spring-core 5.3.15 -> 5.3.16
> * org.springframework:spring-expression 5.3.15 -> 5.3.16
> * org.springframework:spring-oxm 5.3.15 -> 5.3.16
> * org.springframework:spring-test 5.3.15 -> 5.3.16
> * org.springframework:spring-web 5.3.15 -> 5.3.16
> * org.springframework:spring-webmvc 5.3.15 -> 5.3.16



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


[jira] [Updated] (LOG4J2-3428) Update 3rd party dependencies for 2.17.3

2022-03-07 Thread Gary D. Gregory (Jira)


 [ 
https://issues.apache.org/jira/browse/LOG4J2-3428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary D. Gregory updated LOG4J2-3428:

Description: 
This ticket should only be closed when we release 2.17.3.

The updated dependencies are:

* com.fasterxml.jackson.core:jackson-annotations 2.13.1 -> 2.13.2
* com.fasterxml.jackson.core:jackson-core 2.13.1 -> 2.13.2
* com.fasterxml.jackson.core:jackson-databind 2.13.1 -> 2.13.2
* com.fasterxml.jackson.dataformat:jackson-dataformat-xml 2.13.1 -> 2.13.2
* com.fasterxml.jackson.dataformat:jackson-dataformat-yaml 2.13.1 -> 2.13.2
* com.fasterxml.jackson.module:jackson-module-jaxb-annotations 2.13.1 -> 2.13.2
* com.google.guava:guava-testlib 31.0.1-jre -> 31.1-jre
* de.flapdoodle.embed:de.flapdoodle.embed.mongo 3.4.1 -> 3.4.3
* org.awaitility:awaitility 4.1.1 -> 4.2.0
* org.codehaus.groovy:groovy-dateutil 3.0.9 -> 3.0.10
* org.codehaus.groovy:groovy-jsr223 3.0.9 -> 3.0.10
* org.springframework:spring-aop 5.3.15 -> 5.3.16
* org.springframework:spring-beans 5.3.15 -> 5.3.16
* org.springframework:spring-context 5.3.15 -> 5.3.16
* org.springframework:spring-context-support 5.3.15 -> 5.3.16
* org.springframework:spring-core 5.3.15 -> 5.3.16
* org.springframework:spring-expression 5.3.15 -> 5.3.16
* org.springframework:spring-oxm 5.3.15 -> 5.3.16
* org.springframework:spring-test 5.3.15 -> 5.3.16
* org.springframework:spring-web 5.3.15 -> 5.3.16
* org.springframework:spring-webmvc 5.3.15 -> 5.3.16


  was:
The updated dependencies are:

* com.fasterxml.jackson.core:jackson-annotations 2.13.1 -> 2.13.2
* com.fasterxml.jackson.core:jackson-core 2.13.1 -> 2.13.2
* com.fasterxml.jackson.core:jackson-databind 2.13.1 -> 2.13.2
* com.fasterxml.jackson.dataformat:jackson-dataformat-xml 2.13.1 -> 2.13.2
* com.fasterxml.jackson.dataformat:jackson-dataformat-yaml 2.13.1 -> 2.13.2
* com.fasterxml.jackson.module:jackson-module-jaxb-annotations 2.13.1 -> 2.13.2
* com.google.guava:guava-testlib 31.0.1-jre -> 31.1-jre
* de.flapdoodle.embed:de.flapdoodle.embed.mongo 3.4.1 -> 3.4.3
* org.awaitility:awaitility 4.1.1 -> 4.2.0
* org.codehaus.groovy:groovy-dateutil 3.0.9 -> 3.0.10
* org.codehaus.groovy:groovy-jsr223 3.0.9 -> 3.0.10
* org.springframework:spring-aop 5.3.15 -> 5.3.16
* org.springframework:spring-beans 5.3.15 -> 5.3.16
* org.springframework:spring-context 5.3.15 -> 5.3.16
* org.springframework:spring-context-support 5.3.15 -> 5.3.16
* org.springframework:spring-core 5.3.15 -> 5.3.16
* org.springframework:spring-expression 5.3.15 -> 5.3.16
* org.springframework:spring-oxm 5.3.15 -> 5.3.16
* org.springframework:spring-test 5.3.15 -> 5.3.16
* org.springframework:spring-web 5.3.15 -> 5.3.16
* org.springframework:spring-webmvc 5.3.15 -> 5.3.16



> Update 3rd party dependencies for 2.17.3
> 
>
> Key: LOG4J2-3428
> URL: https://issues.apache.org/jira/browse/LOG4J2-3428
> Project: Log4j 2
>  Issue Type: Task
>  Components: Build
>Reporter: Gary D. Gregory
>Priority: Major
> Fix For: 2.17.3
>
>
> This ticket should only be closed when we release 2.17.3.
> The updated dependencies are:
> * com.fasterxml.jackson.core:jackson-annotations 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.core:jackson-core 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.core:jackson-databind 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.dataformat:jackson-dataformat-xml 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.dataformat:jackson-dataformat-yaml 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.module:jackson-module-jaxb-annotations 2.13.1 -> 
> 2.13.2
> * com.google.guava:guava-testlib 31.0.1-jre -> 31.1-jre
> * de.flapdoodle.embed:de.flapdoodle.embed.mongo 3.4.1 -> 3.4.3
> * org.awaitility:awaitility 4.1.1 -> 4.2.0
> * org.codehaus.groovy:groovy-dateutil 3.0.9 -> 3.0.10
> * org.codehaus.groovy:groovy-jsr223 3.0.9 -> 3.0.10
> * org.springframework:spring-aop 5.3.15 -> 5.3.16
> * org.springframework:spring-beans 5.3.15 -> 5.3.16
> * org.springframework:spring-context 5.3.15 -> 5.3.16
> * org.springframework:spring-context-support 5.3.15 -> 5.3.16
> * org.springframework:spring-core 5.3.15 -> 5.3.16
> * org.springframework:spring-expression 5.3.15 -> 5.3.16
> * org.springframework:spring-oxm 5.3.15 -> 5.3.16
> * org.springframework:spring-test 5.3.15 -> 5.3.16
> * org.springframework:spring-web 5.3.15 -> 5.3.16
> * org.springframework:spring-webmvc 5.3.15 -> 5.3.16



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


[jira] [Updated] (LOG4J2-3428) Update 3rd party dependencies for 2.17.3

2022-03-07 Thread Gary D. Gregory (Jira)


 [ 
https://issues.apache.org/jira/browse/LOG4J2-3428?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary D. Gregory updated LOG4J2-3428:

Description: 
The updated dependencies are:

* com.fasterxml.jackson.core:jackson-annotations 2.13.1 -> 2.13.2
* com.fasterxml.jackson.core:jackson-core 2.13.1 -> 2.13.2
* com.fasterxml.jackson.core:jackson-databind 2.13.1 -> 2.13.2
* com.fasterxml.jackson.dataformat:jackson-dataformat-xml 2.13.1 -> 2.13.2
* com.fasterxml.jackson.dataformat:jackson-dataformat-yaml 2.13.1 -> 2.13.2
* com.fasterxml.jackson.module:jackson-module-jaxb-annotations 2.13.1 -> 2.13.2
* com.google.guava:guava-testlib 31.0.1-jre -> 31.1-jre
* de.flapdoodle.embed:de.flapdoodle.embed.mongo 3.4.1 -> 3.4.3
* org.awaitility:awaitility 4.1.1 -> 4.2.0
* org.codehaus.groovy:groovy-dateutil 3.0.9 -> 3.0.10
* org.codehaus.groovy:groovy-jsr223 3.0.9 -> 3.0.10
* org.springframework:spring-aop 5.3.15 -> 5.3.16
* org.springframework:spring-beans 5.3.15 -> 5.3.16
* org.springframework:spring-context 5.3.15 -> 5.3.16
* org.springframework:spring-context-support 5.3.15 -> 5.3.16
* org.springframework:spring-core 5.3.15 -> 5.3.16
* org.springframework:spring-expression 5.3.15 -> 5.3.16
* org.springframework:spring-oxm 5.3.15 -> 5.3.16
* org.springframework:spring-test 5.3.15 -> 5.3.16
* org.springframework:spring-web 5.3.15 -> 5.3.16
* org.springframework:spring-webmvc 5.3.15 -> 5.3.16


  was:
The updated dependencies are:
 * TODO


> Update 3rd party dependencies for 2.17.3
> 
>
> Key: LOG4J2-3428
> URL: https://issues.apache.org/jira/browse/LOG4J2-3428
> Project: Log4j 2
>  Issue Type: Task
>  Components: Build
>Reporter: Gary D. Gregory
>Priority: Major
> Fix For: 2.17.3
>
>
> The updated dependencies are:
> * com.fasterxml.jackson.core:jackson-annotations 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.core:jackson-core 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.core:jackson-databind 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.dataformat:jackson-dataformat-xml 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.dataformat:jackson-dataformat-yaml 2.13.1 -> 2.13.2
> * com.fasterxml.jackson.module:jackson-module-jaxb-annotations 2.13.1 -> 
> 2.13.2
> * com.google.guava:guava-testlib 31.0.1-jre -> 31.1-jre
> * de.flapdoodle.embed:de.flapdoodle.embed.mongo 3.4.1 -> 3.4.3
> * org.awaitility:awaitility 4.1.1 -> 4.2.0
> * org.codehaus.groovy:groovy-dateutil 3.0.9 -> 3.0.10
> * org.codehaus.groovy:groovy-jsr223 3.0.9 -> 3.0.10
> * org.springframework:spring-aop 5.3.15 -> 5.3.16
> * org.springframework:spring-beans 5.3.15 -> 5.3.16
> * org.springframework:spring-context 5.3.15 -> 5.3.16
> * org.springframework:spring-context-support 5.3.15 -> 5.3.16
> * org.springframework:spring-core 5.3.15 -> 5.3.16
> * org.springframework:spring-expression 5.3.15 -> 5.3.16
> * org.springframework:spring-oxm 5.3.15 -> 5.3.16
> * org.springframework:spring-test 5.3.15 -> 5.3.16
> * org.springframework:spring-web 5.3.15 -> 5.3.16
> * org.springframework:spring-webmvc 5.3.15 -> 5.3.16



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


[jira] [Commented] (LOG4J2-3428) Update 3rd party dependencies for 2.17.3

2022-03-07 Thread ASF subversion and git services (Jira)


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

ASF subversion and git services commented on LOG4J2-3428:
-

Commit 11c6e65e5b22cfcf1cb07a554f147bcd5ee9e604 in logging-log4j2's branch 
refs/heads/release-2.x from Gary Gregory
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=11c6e65 ]

[LOG4J2-3428] Update 3rd party dependencies for 2.17.3

* com.fasterxml.jackson.core:jackson-annotations 2.13.1 -> 2.13.2
* com.fasterxml.jackson.core:jackson-core 2.13.1 -> 2.13.2
* com.fasterxml.jackson.core:jackson-databind 2.13.1 -> 2.13.2
* com.fasterxml.jackson.dataformat:jackson-dataformat-xml 2.13.1 ->
2.13.2
* com.fasterxml.jackson.dataformat:jackson-dataformat-yaml 2.13.1 ->
2.13.2
* com.fasterxml.jackson.module:jackson-module-jaxb-annotations 2.13.1 ->
2.13.2
* com.google.guava:guava-testlib 31.0.1-jre -> 31.1-jre
* de.flapdoodle.embed:de.flapdoodle.embed.mongo 3.4.1 -> 3.4.3
* org.awaitility:awaitility 4.1.1 -> 4.2.0
* org.codehaus.groovy:groovy-dateutil 3.0.9 -> 3.0.10
* org.codehaus.groovy:groovy-jsr223 3.0.9 -> 3.0.10
* org.springframework:spring-aop 5.3.15 -> 5.3.16
* org.springframework:spring-beans 5.3.15 -> 5.3.16
* org.springframework:spring-context 5.3.15 -> 5.3.16
* org.springframework:spring-context-support 5.3.15 -> 5.3.16
* org.springframework:spring-core 5.3.15 -> 5.3.16
* org.springframework:spring-expression 5.3.15 -> 5.3.16
* org.springframework:spring-oxm 5.3.15 -> 5.3.16
* org.springframework:spring-test 5.3.15 -> 5.3.16
* org.springframework:spring-web 5.3.15 -> 5.3.16
* org.springframework:spring-webmvc 5.3.15 -> 5.3.16


> Update 3rd party dependencies for 2.17.3
> 
>
> Key: LOG4J2-3428
> URL: https://issues.apache.org/jira/browse/LOG4J2-3428
> Project: Log4j 2
>  Issue Type: Task
>  Components: Build
>Reporter: Gary D. Gregory
>Priority: Major
> Fix For: 2.17.3
>
>
> The updated dependencies are:
>  * TODO



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


[jira] [Created] (LOG4J2-3428) Update 3rd party dependencies for 2.17.3

2022-03-07 Thread Gary D. Gregory (Jira)
Gary D. Gregory created LOG4J2-3428:
---

 Summary: Update 3rd party dependencies for 2.17.3
 Key: LOG4J2-3428
 URL: https://issues.apache.org/jira/browse/LOG4J2-3428
 Project: Log4j 2
  Issue Type: Task
  Components: Build
Reporter: Gary D. Gregory
 Fix For: 2.17.3


The updated dependencies are:
 * TODO



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


[GitHub] [logging-log4j2] garydgregory commented on a change in pull request #786: [LOG4J2-3426] Refactors wrapping code

2022-03-07 Thread GitBox


garydgregory commented on a change in pull request #786:
URL: https://github.com/apache/logging-log4j2/pull/786#discussion_r820738169



##
File path: 
log4j-1.2-api/src/main/java/org/apache/log4j/bridge/FilterWrapper.java
##
@@ -27,6 +27,16 @@
 
 private final org.apache.logging.log4j.core.Filter filter;
 
+public static Filter wrap(org.apache.logging.log4j.core.Filter filter) {
+if (filter instanceof FilterAdapter) {

Review comment:
   Test if the input is already a FilterWrapper and return it?

##
File path: 
log4j-1.2-api/src/main/java/org/apache/log4j/bridge/AppenderWrapper.java
##
@@ -34,6 +35,19 @@
 private static final Logger LOGGER = StatusLogger.getLogger();
 private final org.apache.logging.log4j.core.Appender appender;
 
+public static Appender wrap(org.apache.logging.log4j.core.Appender 
appender) {
+if (appender instanceof Adapter) {

Review comment:
   Might as well also test and return the input if it is already an 
AppenderWrapper. Also, since we does not always "wrap", we might want to keep 
using "adapt" as the verb.

##
File path: 
log4j-1.2-api/src/main/java/org/apache/log4j/builders/appender/SyslogAppenderBuilder.java
##
@@ -127,20 +127,15 @@ private Appender createAppender(final String name, final 
Log4j1Configuration con
 final AtomicReference host = new AtomicReference<>();
 final AtomicInteger port = new AtomicInteger();
 resolveSyslogHost(syslogHost, host, port);
-org.apache.logging.log4j.core.Layout 
appenderLayout;
-if (layout instanceof LayoutWrapper) {
-appenderLayout = ((LayoutWrapper) layout).getLayout();
-} else if (layout != null) {
-appenderLayout = new LayoutAdapter(layout);
-} else {
+org.apache.logging.log4j.core.Layout 
appenderLayout = LayoutAdapter.adapt(layout);
+if (appenderLayout == null) {
 appenderLayout = SyslogLayout.newBuilder()
 .setFacility(Facility.toFacility(facility))
-.setConfiguration(configuration)
-.build();
+.setConfiguration(configuration).build();

Review comment:
   I like the existing formatting better.

##
File path: 
log4j-1.2-api/src/main/java/org/apache/log4j/bridge/LayoutAdapter.java
##
@@ -29,10 +29,23 @@
 public class LayoutAdapter implements 
org.apache.logging.log4j.core.Layout {
 private Layout layout;
 
-public LayoutAdapter(Layout layout) {
+public static org.apache.logging.log4j.core.Layout adapt(Layout layout) 
{
+if (layout instanceof LayoutWrapper) {

Review comment:
   Test if input is already a LayoutAdapter and return it?

##
File path: 
log4j-1.2-api/src/main/java/org/apache/log4j/bridge/LayoutWrapper.java
##
@@ -26,6 +26,16 @@
 
 private final org.apache.logging.log4j.core.Layout layout;
 
+public static Layout wrap(org.apache.logging.log4j.core.Layout layout) {
+if (layout instanceof LayoutAdapter) {

Review comment:
   Test if input is already a LayoutWrapper and return it?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[jira] [Commented] (LOG4J2-3080) Messages logged inconsistently when using JsonTemplateLayout.

2022-03-07 Thread ASF subversion and git services (Jira)


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

ASF subversion and git services commented on LOG4J2-3080:
-

Commit b03d7608931aa4a2ad0a6c486079781b154e5c2c in logging-log4j2's branch 
refs/heads/dependabot/maven/org.apache.felix-maven-bundle-plugin-5.1.4 from 
Piotr P. Karwasz
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=b03d760 ]

Provide a uniform Log4j 1.x message factory

This PR provides a factory method that decides the type of message
based on the runtime type of the logged object (cf. [LOG4J2-3080](
https://issues.apache.org/jira/browse/LOG4J2-3080)).

These are applied to both `maybeLog` and `forceLog`.

> Messages logged inconsistently when using JsonTemplateLayout.
> -
>
> Key: LOG4J2-3080
> URL: https://issues.apache.org/jira/browse/LOG4J2-3080
> Project: Log4j 2
>  Issue Type: Bug
>  Components: JsonTemplateLayout
>Affects Versions: 2.14.1
>Reporter: Schubert Fernandes
>Assignee: Volkan Yazici
>Priority: Major
> Fix For: 3.0.0, 2.15.0
>
> Attachments: log4j.json.event.layout.zip
>
>
> When using the JsonTemplateLayout and configuring the message with a 
> fallbackKey...
> {code:json}
>   "message": {
> "$resolver": "message",
> "fallbackKey": "asString"
>   }
> {code}
> the fallbackKey is not consistently used.
> When logging via _org.apache.log4j.Category.info(Object)_ the message string 
> is logged directly without using the property defined in _fallbackKey_, e.g. 
> {panel}
> {"timestamp":"2021-04-21T14:25:27.625+01:00","loggerName":"explore.log4j.json.template.layout.Main","level":"INFO","{color:red}message":"Message
>  logged using org.apache.log4j.Category.info(Object)"}{color}
> {panel}
> but when logging using _org.apache.logging.log4j.Logger.info(String)_ the 
> message is correctly logged in the _asString_ property as required, i.e.
> {panel}
> {"timestamp":"2021-04-21T14:25:27.628+01:00","loggerName":"explore.log4j.json.template.layout.Main","level":"INFO","{color:green}message":{*"asString"*:"Message
>  logged using org.apache.logging.log4j.Logger.info(String)"}}{color}
> {panel}
> Sample Maven project attached to reproduce.



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


[jira] [Commented] (LOG4J2-3424) JDBC Appender configuration properties not handled correctly after upgrading to 2.17.2

2022-03-07 Thread ASF subversion and git services (Jira)


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

ASF subversion and git services commented on LOG4J2-3424:
-

Commit 4492c26f72ce5aa7e28c96242065a472b17a882f in logging-log4j2's branch 
refs/heads/dependabot/maven/org.apache.felix-maven-bundle-plugin-5.1.4 from 
Carter Kozak
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=4492c26 ]

LOG4J2-3424: Correctly handle property attribute values

This fixes handling of properties in .properties configurations
as well as those defined using ``
which are parsed slightly differently from those which use the
`value` syntax.


> JDBC Appender configuration properties not handled correctly after upgrading 
> to 2.17.2
> --
>
> Key: LOG4J2-3424
> URL: https://issues.apache.org/jira/browse/LOG4J2-3424
> Project: Log4j 2
>  Issue Type: Dependency upgrade
>  Components: Appenders, Configuration
>Affects Versions: 2.17.2
>Reporter: Grzegorz Grzybek
>Assignee: Carter Kozak
>Priority: Major
> Fix For: 2.17.3
>
>
> I'm a maintainer of Pax Logging project and for long time we had this 
> configuration in integration tests:
> {noformat}
> appender.jdbc.type = JDBC
> appender.jdbc.name = jdbc
> appender.jdbc.tableName = LOG
> appender.jdbc.connectionSource.type = DriverManager
> appender.jdbc.connectionSource.driverClassName = org.h2.Driver
> appender.jdbc.connectionSource.connectionString = 
> jdbc:h2:tcp://localhost:PORT/logsdb
> appender.jdbc.connectionSource.p1.type = property
> appender.jdbc.connectionSource.p1.name = SCHEMA
> appender.jdbc.connectionSource.p1.value = logs
> appender.jdbc.connectionSource.p2.type = property
> appender.jdbc.connectionSource.p2.name = QUERY_TIMEOUT
> appender.jdbc.connectionSource.p2.value = 5000
> appender.jdbc.connectionSource.p3.type = property
> appender.jdbc.connectionSource.p3.name = user
> appender.jdbc.connectionSource.p3.value = logadmin
> appender.jdbc.connectionSource.p4.type = property
> appender.jdbc.connectionSource.p4.name = password
> appender.jdbc.connectionSource.p4.value = logpassword
> appender.jdbc.c1.type = Column
> appender.jdbc.c1.name = DATE
> appender.jdbc.c1.isEventTimestamp = true
> appender.jdbc.c2.type = Column
> appender.jdbc.c2.name = LEVEL
> appender.jdbc.c2.pattern = %level
> appender.jdbc.c2.isUnicode = false
> appender.jdbc.c3.type = Column
> appender.jdbc.c3.name = SOURCE
> appender.jdbc.c3.pattern = %logger
> appender.jdbc.c3.isUnicode = false
> appender.jdbc.c4.type = Column
> appender.jdbc.c4.name = MESSAGE
> appender.jdbc.c4.pattern = %message
> appender.jdbc.c4.isUnicode = false
> rootLogger.level = info
> rootLogger.appenderRef.console.ref = console
> logger.my.name = my.logger
> logger.my.level = trace
> logger.my.additivity = false
> logger.my.appenderRef.jdbc.ref = jdbc
> {noformat}
> now the properties are not handled correctly. For example with:
> {noformat}
> appender.jdbc.connectionSource.p1.type = property
> appender.jdbc.connectionSource.p1.name = SCHEMA
> appender.jdbc.connectionSource.p1.value = logs
> {noformat}
> I'm getting (in 
> {{org.apache.logging.log4j.core.config.plugins.util.PluginBuilder#generateParameters()}}):
> {noformat}
> createProperty(name="SCHEMA", value="logs", value="null")
> {noformat}
> call and 
> {{org.apache.logging.log4j.core.config.Property#createProperty(java.lang.String,
>  java.lang.String, java.lang.String)}} is called with:
> * SCHEMA
> * logs
> * null
> values.
> In debug logs there's:
> {noformat}
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : Building 
> Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : 
> createProperty(name="password", value="logpassword", value="null")
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : Building 
> Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : 
> createProperty(name="SCHEMA", value="logs", value="null")
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : Building 
> Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : 
> createProperty(name="user", value="logadmin", value="null")
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : Building 
> Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : 
> createProperty(name="QUERY_TIMEOUT", value="5000", value="null")
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : Building 
> Plugin[name=connectionSource, 
> class=org.apache.logging.

[jira] [Commented] (LOG4J2-3423) JAR file containing Log4j configuration isn't closed

2022-03-07 Thread ASF subversion and git services (Jira)


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

ASF subversion and git services commented on LOG4J2-3423:
-

Commit ab2a9bf1538cbc39c81d782ed157d247364c0154 in logging-log4j2's branch 
refs/heads/dependabot/maven/org.apache.maven.plugins-maven-scm-plugin-1.12.2 
from Ralph Goers
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=ab2a9bf ]

LOG4J2-3423 - Get lastModified of the file


> JAR file containing Log4j configuration isn't closed
> 
>
> Key: LOG4J2-3423
> URL: https://issues.apache.org/jira/browse/LOG4J2-3423
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.14.0
> Environment: Windows
>Reporter: Radim Tlusty
>Assignee: Gary D. Gregory
>Priority: Major
> Fix For: 2.17.3
>
>
> If the Log4j configuration file is inside of a JAR file, then the JAR file 
> (which is backed by the {{JarURLConnection}} retrieved from 
> {{{}URL.openConnection{}}}) isn't closed.
> This causes problems on Tomcat running on Windows during undeploying of an 
> application, because the opened JAR file can't be deleted.
> The problem was introduced during implementation of LOG4J2-2901 (version 
> 2.14.0), where the {{URL.openStream}} was replaced by {{URL.openConnection}} 
> in the class {{{}org.apache.logging.log4j.core.config.ConfigurationSource{}}}.
> The proposed solution (https://github.com/apache/logging-log4j2/pull/780) is 
> to use the {{URL.openConnection}} only when needed (~ configuration URL has 
> HTTPS protocol), otherwise similar code as in previous versions (<= 2.13.3) 
> would be used.
>  



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


[jira] [Commented] (LOG4J2-3080) Messages logged inconsistently when using JsonTemplateLayout.

2022-03-07 Thread ASF subversion and git services (Jira)


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

ASF subversion and git services commented on LOG4J2-3080:
-

Commit b03d7608931aa4a2ad0a6c486079781b154e5c2c in logging-log4j2's branch 
refs/heads/dependabot/maven/org.apache.maven.plugins-maven-scm-plugin-1.12.2 
from Piotr P. Karwasz
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=b03d760 ]

Provide a uniform Log4j 1.x message factory

This PR provides a factory method that decides the type of message
based on the runtime type of the logged object (cf. [LOG4J2-3080](
https://issues.apache.org/jira/browse/LOG4J2-3080)).

These are applied to both `maybeLog` and `forceLog`.

> Messages logged inconsistently when using JsonTemplateLayout.
> -
>
> Key: LOG4J2-3080
> URL: https://issues.apache.org/jira/browse/LOG4J2-3080
> Project: Log4j 2
>  Issue Type: Bug
>  Components: JsonTemplateLayout
>Affects Versions: 2.14.1
>Reporter: Schubert Fernandes
>Assignee: Volkan Yazici
>Priority: Major
> Fix For: 3.0.0, 2.15.0
>
> Attachments: log4j.json.event.layout.zip
>
>
> When using the JsonTemplateLayout and configuring the message with a 
> fallbackKey...
> {code:json}
>   "message": {
> "$resolver": "message",
> "fallbackKey": "asString"
>   }
> {code}
> the fallbackKey is not consistently used.
> When logging via _org.apache.log4j.Category.info(Object)_ the message string 
> is logged directly without using the property defined in _fallbackKey_, e.g. 
> {panel}
> {"timestamp":"2021-04-21T14:25:27.625+01:00","loggerName":"explore.log4j.json.template.layout.Main","level":"INFO","{color:red}message":"Message
>  logged using org.apache.log4j.Category.info(Object)"}{color}
> {panel}
> but when logging using _org.apache.logging.log4j.Logger.info(String)_ the 
> message is correctly logged in the _asString_ property as required, i.e.
> {panel}
> {"timestamp":"2021-04-21T14:25:27.628+01:00","loggerName":"explore.log4j.json.template.layout.Main","level":"INFO","{color:green}message":{*"asString"*:"Message
>  logged using org.apache.logging.log4j.Logger.info(String)"}}{color}
> {panel}
> Sample Maven project attached to reproduce.



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


[jira] [Commented] (LOG4J2-3424) JDBC Appender configuration properties not handled correctly after upgrading to 2.17.2

2022-03-07 Thread ASF subversion and git services (Jira)


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

ASF subversion and git services commented on LOG4J2-3424:
-

Commit 4492c26f72ce5aa7e28c96242065a472b17a882f in logging-log4j2's branch 
refs/heads/dependabot/maven/org.apache.maven.plugins-maven-scm-plugin-1.12.2 
from Carter Kozak
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=4492c26 ]

LOG4J2-3424: Correctly handle property attribute values

This fixes handling of properties in .properties configurations
as well as those defined using ``
which are parsed slightly differently from those which use the
`value` syntax.


> JDBC Appender configuration properties not handled correctly after upgrading 
> to 2.17.2
> --
>
> Key: LOG4J2-3424
> URL: https://issues.apache.org/jira/browse/LOG4J2-3424
> Project: Log4j 2
>  Issue Type: Dependency upgrade
>  Components: Appenders, Configuration
>Affects Versions: 2.17.2
>Reporter: Grzegorz Grzybek
>Assignee: Carter Kozak
>Priority: Major
> Fix For: 2.17.3
>
>
> I'm a maintainer of Pax Logging project and for long time we had this 
> configuration in integration tests:
> {noformat}
> appender.jdbc.type = JDBC
> appender.jdbc.name = jdbc
> appender.jdbc.tableName = LOG
> appender.jdbc.connectionSource.type = DriverManager
> appender.jdbc.connectionSource.driverClassName = org.h2.Driver
> appender.jdbc.connectionSource.connectionString = 
> jdbc:h2:tcp://localhost:PORT/logsdb
> appender.jdbc.connectionSource.p1.type = property
> appender.jdbc.connectionSource.p1.name = SCHEMA
> appender.jdbc.connectionSource.p1.value = logs
> appender.jdbc.connectionSource.p2.type = property
> appender.jdbc.connectionSource.p2.name = QUERY_TIMEOUT
> appender.jdbc.connectionSource.p2.value = 5000
> appender.jdbc.connectionSource.p3.type = property
> appender.jdbc.connectionSource.p3.name = user
> appender.jdbc.connectionSource.p3.value = logadmin
> appender.jdbc.connectionSource.p4.type = property
> appender.jdbc.connectionSource.p4.name = password
> appender.jdbc.connectionSource.p4.value = logpassword
> appender.jdbc.c1.type = Column
> appender.jdbc.c1.name = DATE
> appender.jdbc.c1.isEventTimestamp = true
> appender.jdbc.c2.type = Column
> appender.jdbc.c2.name = LEVEL
> appender.jdbc.c2.pattern = %level
> appender.jdbc.c2.isUnicode = false
> appender.jdbc.c3.type = Column
> appender.jdbc.c3.name = SOURCE
> appender.jdbc.c3.pattern = %logger
> appender.jdbc.c3.isUnicode = false
> appender.jdbc.c4.type = Column
> appender.jdbc.c4.name = MESSAGE
> appender.jdbc.c4.pattern = %message
> appender.jdbc.c4.isUnicode = false
> rootLogger.level = info
> rootLogger.appenderRef.console.ref = console
> logger.my.name = my.logger
> logger.my.level = trace
> logger.my.additivity = false
> logger.my.appenderRef.jdbc.ref = jdbc
> {noformat}
> now the properties are not handled correctly. For example with:
> {noformat}
> appender.jdbc.connectionSource.p1.type = property
> appender.jdbc.connectionSource.p1.name = SCHEMA
> appender.jdbc.connectionSource.p1.value = logs
> {noformat}
> I'm getting (in 
> {{org.apache.logging.log4j.core.config.plugins.util.PluginBuilder#generateParameters()}}):
> {noformat}
> createProperty(name="SCHEMA", value="logs", value="null")
> {noformat}
> call and 
> {{org.apache.logging.log4j.core.config.Property#createProperty(java.lang.String,
>  java.lang.String, java.lang.String)}} is called with:
> * SCHEMA
> * logs
> * null
> values.
> In debug logs there's:
> {noformat}
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : Building 
> Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : 
> createProperty(name="password", value="logpassword", value="null")
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : Building 
> Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : 
> createProperty(name="SCHEMA", value="logs", value="null")
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : Building 
> Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : 
> createProperty(name="user", value="logadmin", value="null")
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : Building 
> Plugin[name=property, class=org.apache.logging.log4j.core.config.Property].
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : 
> createProperty(name="QUERY_TIMEOUT", value="5000", value="null")
> org.ops4j.pax.logging.pax-logging-api [log4j2] DEBUG : Building 
> Plugin[name=connectionSource, 
> class=org.apache.lo

[jira] [Commented] (LOG4J2-3423) JAR file containing Log4j configuration isn't closed

2022-03-07 Thread ASF subversion and git services (Jira)


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

ASF subversion and git services commented on LOG4J2-3423:
-

Commit ab2a9bf1538cbc39c81d782ed157d247364c0154 in logging-log4j2's branch 
refs/heads/dependabot/maven/org.apache.felix-maven-bundle-plugin-5.1.4 from 
Ralph Goers
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=ab2a9bf ]

LOG4J2-3423 - Get lastModified of the file


> JAR file containing Log4j configuration isn't closed
> 
>
> Key: LOG4J2-3423
> URL: https://issues.apache.org/jira/browse/LOG4J2-3423
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.14.0
> Environment: Windows
>Reporter: Radim Tlusty
>Assignee: Gary D. Gregory
>Priority: Major
> Fix For: 2.17.3
>
>
> If the Log4j configuration file is inside of a JAR file, then the JAR file 
> (which is backed by the {{JarURLConnection}} retrieved from 
> {{{}URL.openConnection{}}}) isn't closed.
> This causes problems on Tomcat running on Windows during undeploying of an 
> application, because the opened JAR file can't be deleted.
> The problem was introduced during implementation of LOG4J2-2901 (version 
> 2.14.0), where the {{URL.openStream}} was replaced by {{URL.openConnection}} 
> in the class {{{}org.apache.logging.log4j.core.config.ConfigurationSource{}}}.
> The proposed solution (https://github.com/apache/logging-log4j2/pull/780) is 
> to use the {{URL.openConnection}} only when needed (~ configuration URL has 
> HTTPS protocol), otherwise similar code as in previous versions (<= 2.13.3) 
> would be used.
>  



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


[GitHub] [logging-log4j2] garydgregory commented on a change in pull request #784: [LOG4J2-3423] Refactoring of URLConnection code

2022-03-07 Thread GitBox


garydgregory commented on a change in pull request #784:
URL: https://github.com/apache/logging-log4j2/pull/784#discussion_r820722891



##
File path: 
log4j-core/src/test/java/org/apache/logging/log4j/core/config/ConfigurationSourceTest.java
##
@@ -30,4 +40,29 @@ public void testJira_LOG4J2_2770_byteArray() throws 
Exception {
 ConfigurationSource configurationSource = new ConfigurationSource(new 
ByteArrayInputStream(new byte[] { 'a', 'b' }));
 assertNotNull(configurationSource.resetInputStream());
 }
+
+/**
+ * Checks if the usage of 'jar:' URLs does not increase the file descriptor
+ * count. Does not work on Windows, since the is no way to count open
+ * descriptors.
+ * 

Review comment:
   Hi @ppkarwasz 
   Can't this be tested everywhere by simply trying to copy or delete the jar 
file? That's the real-life use case IIRC.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [logging-log4j2] garydgregory commented on a change in pull request #784: [LOG4J2-3423] Refactoring of URLConnection code

2022-03-07 Thread GitBox


garydgregory commented on a change in pull request #784:
URL: https://github.com/apache/logging-log4j2/pull/784#discussion_r820722891



##
File path: 
log4j-core/src/test/java/org/apache/logging/log4j/core/config/ConfigurationSourceTest.java
##
@@ -30,4 +40,29 @@ public void testJira_LOG4J2_2770_byteArray() throws 
Exception {
 ConfigurationSource configurationSource = new ConfigurationSource(new 
ByteArrayInputStream(new byte[] { 'a', 'b' }));
 assertNotNull(configurationSource.resetInputStream());
 }
+
+/**
+ * Checks if the usage of 'jar:' URLs does not increase the file descriptor
+ * count. Does not work on Windows, since the is no way to count open
+ * descriptors.
+ * 

Review comment:
   Hi @ppkarwasz 
   Can't this be tested everywhere by simply trying to copy or delete the jar 
file?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[jira] [Comment Edited] (LOG4J2-3419) Unable to create custom logging level using log4j 2 Bridge API

2022-03-07 Thread Ragini Gawande (Jira)


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

Ragini Gawande edited comment on LOG4J2-3419 at 3/7/22, 1:46 PM:
-

I did some debugging here and following is my finding

log4j-1.2-api/src/main/java/org/apache/log4j/helpers/OptionConverter.java
{noformat}
157 public static Level toLevel(String value, Level defaultValue) {
158 if (value == null) {
159 return defaultValue;
160 }
161
162 value = value.trim();
163
164 int hashIndex = value.indexOf('#');
165 if (hashIndex == -1) {
166 if ("NULL".equalsIgnoreCase(value)) {
167 return null;
168 }
169 // no class name specified : use standard Level class
170 return Level.toLevel(value, defaultValue);
171 }{noformat}
here its using Level.toLevel(value, defaultValue) of org.apache.log4j.Level 
instead of org.apache.logging.log4j.Level.toLevel

as we have defined new custom levels in 
org.apache.logging.log4j.Level.forName() its unable to return the correct level 
from org.apache.log4j.Level and instead of actual level it returns defaultValue 
which is DEBUG.

Can you please verify if the findings are correct? if yes then please suggest a 
way to define custom logging level for org.apache.log4j.Level


was (Author: JIRAUSER285931):
I did some debugging here and following is my finding

log4j-1.2-api/src/main/java/org/apache/log4j/helpers/OptionConverter.java

 
{noformat}
157 public static Level toLevel(String value, Level defaultValue) {
158 if (value == null) {
159 return defaultValue;
160 }
161
162 value = value.trim();
163
164 int hashIndex = value.indexOf('#');
165 if (hashIndex == -1) {
166 if ("NULL".equalsIgnoreCase(value)) {
167 return null;
168 }
169 // no class name specified : use standard Level class
170 return Level.toLevel(value, defaultValue);
171 }{noformat}
 

 

here its using Level.toLevel(value, defaultValue) of org.apache.log4j.Level 
instead of org.apache.logging.log4j.Level.toLevel

as we have defined new custom levels in 
org.apache.logging.log4j.Level.forName() its unable to return the correct level 
from org.apache.log4j.Level and instead of actual level it returns defaultValue 
which is DEBUG.

 

Can you please verify if the findings are correct? if yes then please suggest a 
way to define custom logging level for org.apache.log4j.Level

> Unable to create custom logging level using log4j 2 Bridge API
> --
>
> Key: LOG4J2-3419
> URL: https://issues.apache.org/jira/browse/LOG4J2-3419
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Log4j 1.2 bridge
>Affects Versions: 2.17.1
> Environment: Using log4j 2 bridge API: log4j-1.2-api-2.17.1.jar
>Reporter: Ragini Gawande
>Assignee: Piotr Karwasz
>Priority: Blocker
>
> Unable to create custom logging level using log4j 2 Bridge API
> Following did not create a custom logging level
> *public static final int FINE_INT = 13000;*
> *public static final Level FINE = new Level(FINE_INT, "FINE", 7);* 
>  
> Using FINE logging level is considered to be DEBUG level by default while 
> printing it
> *Adding log:*
> log.log({*}Level.FINE{*},"PRINT: Level.FINE log");
>  
> *Expected log printed:*
> 2022-02-25 15:50:09,208 Main[6788] :main: example.com.Test *FINE* - PRINT: 
> Level.FINE log 
>  
> *Actual log printed:*
> 2022-02-25 15:50:09,208 Main[6788] :main: example.com.Test *DEBUG* - PRINT: 
> Level.FINE log 



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


[jira] [Commented] (LOG4J2-3419) Unable to create custom logging level using log4j 2 Bridge API

2022-03-07 Thread Ragini Gawande (Jira)


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

Ragini Gawande commented on LOG4J2-3419:


I did some debugging here and following is my finding

log4j-1.2-api/src/main/java/org/apache/log4j/helpers/OptionConverter.java

 
{noformat}
157 public static Level toLevel(String value, Level defaultValue) {
158 if (value == null) {
159 return defaultValue;
160 }
161
162 value = value.trim();
163
164 int hashIndex = value.indexOf('#');
165 if (hashIndex == -1) {
166 if ("NULL".equalsIgnoreCase(value)) {
167 return null;
168 }
169 // no class name specified : use standard Level class
170 return Level.toLevel(value, defaultValue);
171 }{noformat}
 

 

here its using Level.toLevel(value, defaultValue) of org.apache.log4j.Level 
instead of org.apache.logging.log4j.Level.toLevel

as we have defined new custom levels in 
org.apache.logging.log4j.Level.forName() its unable to return the correct level 
from org.apache.log4j.Level and instead of actual level it returns defaultValue 
which is DEBUG.

 

Can you please verify if the findings are correct? if yes then please suggest a 
way to define custom logging level for org.apache.log4j.Level

> Unable to create custom logging level using log4j 2 Bridge API
> --
>
> Key: LOG4J2-3419
> URL: https://issues.apache.org/jira/browse/LOG4J2-3419
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Log4j 1.2 bridge
>Affects Versions: 2.17.1
> Environment: Using log4j 2 bridge API: log4j-1.2-api-2.17.1.jar
>Reporter: Ragini Gawande
>Assignee: Piotr Karwasz
>Priority: Blocker
>
> Unable to create custom logging level using log4j 2 Bridge API
> Following did not create a custom logging level
> *public static final int FINE_INT = 13000;*
> *public static final Level FINE = new Level(FINE_INT, "FINE", 7);* 
>  
> Using FINE logging level is considered to be DEBUG level by default while 
> printing it
> *Adding log:*
> log.log({*}Level.FINE{*},"PRINT: Level.FINE log");
>  
> *Expected log printed:*
> 2022-02-25 15:50:09,208 Main[6788] :main: example.com.Test *FINE* - PRINT: 
> Level.FINE log 
>  
> *Actual log printed:*
> 2022-02-25 15:50:09,208 Main[6788] :main: example.com.Test *DEBUG* - PRINT: 
> Level.FINE log 



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


[GitHub] [logging-log4j2] garydgregory commented on pull request #778: Bump maven-scm-plugin from 1.9.5 to 1.12.2

2022-03-07 Thread GitBox


garydgregory commented on pull request #778:
URL: https://github.com/apache/logging-log4j2/pull/778#issuecomment-1060704144


   @dependabot rebase


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [logging-log4j2] garydgregory commented on pull request #754: Bump maven-bundle-plugin from 3.5.0 to 5.1.4

2022-03-07 Thread GitBox


garydgregory commented on pull request #754:
URL: https://github.com/apache/logging-log4j2/pull/754#issuecomment-1060703907


   @dependabot rebase


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[jira] [Commented] (LOG4J2-3409) workaround for jackson-mapper-asl-1.9.13.jar security vulnerability @ flume-ng

2022-03-07 Thread alexander kravchik (Jira)


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

alexander kravchik commented on LOG4J2-3409:


How are you [~rgoers]  ? 

Do you have ETA ? 

 

Thanks so much,

sasha

 

> workaround for jackson-mapper-asl-1.9.13.jar security vulnerability @ flume-ng
> --
>
> Key: LOG4J2-3409
> URL: https://issues.apache.org/jira/browse/LOG4J2-3409
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Flume Appender
>Affects Versions: 2.17.1
> Environment: java 11
>Reporter: alexander kravchik
>Priority: Major
>
> Dear colleagues, 
> we are using log4j2 with flume-ng appender. 
> The below vulnerabilities are found in the dependent 
> jackson-mapper-asl-1.9.13.jar :
> cve-2019-10202
> cve-2019-10172
> etc...
> Please advise if this will be fixed and planned ETA in case it is already 
> fixed
> Thanks , 
> Sasha



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


[GitHub] [logging-log4j2] ppkarwasz commented on pull request #786: [LOG4J2-3426] Refactors wrapping code

2022-03-07 Thread GitBox


ppkarwasz commented on pull request #786:
URL: https://github.com/apache/logging-log4j2/pull/786#issuecomment-1060427664


   Hi @pooja-achievement ,
   I am waiting for a second opinion on these changes: there is not much sense 
in testing something that will not end up in the next release. If everything is 
alright, we can generate a snapshot.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [logging-log4j2] ppkarwasz commented on pull request #787: [LOG4J2-3427] Add a ServiceLoader tool

2022-03-07 Thread GitBox


ppkarwasz commented on pull request #787:
URL: https://github.com/apache/logging-log4j2/pull/787#issuecomment-1060304477


   @jochenw, yes and it has a `test` scope.
   The scope of dependencies is inherited from the parent POM.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org