aaaygupta commented on issue #2737:
URL:
https://github.com/apache/logging-log4j2/issues/2737#issuecomment-2225692494
> @aaaygupta, could you try placing `static {
org.apache.logging.log4j.status.StatusLogger.getLogger().error("test"); }` just
above the `... Logger = LogManager...` line in `TestLog`? Does it solve the
problem? If not, could you share the stack trace of the exception you get?
@vy
This is the new exception trace
`java.lang.NoClassDefFoundError: com.test.TestLog (initialization failure)
at
java.lang.J9VMInternals.initializationAlreadyFailed(J9VMInternals.java:87)
Caused by: java.lang.BootstrapMethodError:
java.lang.ExceptionInInitializerError
at
org.apache.logging.log4j.spi.AbstractLogger.<clinit>(AbstractLogger.java:107)
at com.test.TestLog.<clinit>(TestLog.java:6)
Caused by: java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.ensureError(J9VMInternals.java:137)
at
java.lang.J9VMInternals.recordInitializationFailure(J9VMInternals.java:126)
at
org.apache.logging.log4j.status.StatusLogger.getLogger(StatusLogger.java:564)
at
org.apache.logging.log4j.internal.DefaultLogBuilder.<clinit>(DefaultLogBuilder.java:40)
at java.lang.Class.forNameImpl(Native Method)
at java.lang.Class.forName(Class.java:343)
at
java.lang.invoke.MethodType.nonPrimitiveClassFromString(MethodType.java:311)
at java.lang.invoke.MethodType.parseIntoClasses(MethodType.java:373)
at
java.lang.invoke.MethodType.fromMethodDescriptorString(MethodType.java:286)
at java.lang.invoke.MethodHandle.getCPMethodTypeAt(Native Method)
at
java.lang.invoke.MethodHandle.resolveInvokeDynamic(MethodHandle.java:849)
... 2 more
Caused by: java.lang.NullPointerException: level
at java.util.Objects.requireNonNull(Objects.java:239)
at
org.apache.logging.log4j.status.StatusConsoleListener.<init>(StatusConsoleListener.java:68)
at
org.apache.logging.log4j.status.StatusConsoleListener.<init>(StatusConsoleListener.java:54)
at
org.apache.logging.log4j.status.StatusLogger.<init>(StatusLogger.java:533)
at
org.apache.logging.log4j.status.StatusLogger$InstanceHolder.<clinit>(StatusLogger.java:505)
... 11 more`
And this is my code
`package com.test;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class TestLog {
static {
org.apache.logging.log4j.status.StatusLogger.getLogger().error("test"); }
private final static Logger
s_logger=LogManager.getLogger(TestLog.class);
public static void main(String[] args) {
testlog4j("test");
}
public static void testlog4j(String a) {
}
}`
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]