[
https://issues.apache.org/jira/browse/LOG4J2-3593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17603569#comment-17603569
]
Marcono1234 commented on LOG4J2-3593:
-------------------------------------
{quote}
That will cause the warning message and StackLocator will fail to find the
caller's class.
[...]
But you are correct that the message is misleading.
{quote}
Yes this issue was mainly about the warning message; but I wasn't sure whether
the problem is that the warning message is incorrect, or whether the warning
message is correct but the {{StackLocator}} behavior is incorrect.
Maybe it would also be good to adjust the warning message to give a hint to set
{{Multi-Release: true}}, or link to a documentation page describing this. As
far as I know neither the Maven Shade Plugin nor the Gradle Shadow plugin
([relevant issue|https://github.com/johnrengelman/shadow/issues/449]) currently
set this attribute automatically, so it is likely that many users forget to set
it.
> 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)