You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Marcono1234 (Jira)" <ji...@apache.org> on 2022/09/12 22:34:00 UTC

[jira] [Updated] (LOG4J2-3593) StackLocator Reflection.getCallerClass warning is misleading / incorrect

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

Marcono1234 updated LOG4J2-3593:
--------------------------------
    Description: 
When the pre-Java 9 {{StackLocator}} is used, but {{Reflection.getCallerClass}} is missing, the following warning is printed to console:
{quote}
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
{quote}

This can for example occur when a JAR with dependencies is created but the Log4j Java 9 specific code is not included, or {{Multi-Release: true}} is not set in the manifest (see also LOG4J2-2834).

The issue is that the warning is misleading or incorrect. It suggests that Log4j is still fully functional, but as seen with LOG4J2-2834, certain functionality breaks (such as {{LogManager.getLogger()}}). 
So maybe the underlying issue here is that the warning is correct, but there is a bug in {{StackLocator}} and it should actually fall back to using {{new Throwable().getStackTrace()}} instead of returning {{null}}?


  was:
When the pre-Java 9 {{StackLocator}} is used, but {{Reflection.getCallerClass}} is missing, the following warning is printed to console:
{quote}
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
{quote}

This can for example occur when a JAR with dependencies is created but the Log4j Java 9 specific code is not included, or {{Multi-Release: true}} is not set in the manifest (see also LOG4J2-2834).

The issue is that the warning is misleading or incorrect. It suggests that Log4j is still fully functional, but as seen with LOG4J2-2834, certain functionality breaks (such as {{LogManager.getLogger()}}). 
So maybe the underlying issue here is that the warning is correct, but there is a bug in {{StackLocator}} and it should actually fall back to using {{new Throwable().getStackTrace()}}?



> StackLocator Reflection.getCallerClass warning is misleading / incorrect
> ------------------------------------------------------------------------
>
>                 Key: LOG4J2-3593
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3593
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.17.2
>            Reporter: Marcono1234
>            Priority: Major
>
> When the pre-Java 9 {{StackLocator}} is used, but {{Reflection.getCallerClass}} is missing, the following warning is printed to console:
> {quote}
> WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
> {quote}
> This can for example occur when a JAR with dependencies is created but the Log4j Java 9 specific code is not included, or {{Multi-Release: true}} is not set in the manifest (see also LOG4J2-2834).
> The issue is that the warning is misleading or incorrect. It suggests that Log4j is still fully functional, but as seen with LOG4J2-2834, certain functionality breaks (such as {{LogManager.getLogger()}}). 
> So maybe the underlying issue here is that the warning is correct, but there is a bug in {{StackLocator}} and it should actually fall back to using {{new Throwable().getStackTrace()}} instead of returning {{null}}?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)