Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-1550

GraalVM native-image problem with AsyncAppender and RollingFileAppender

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • 1.2.3
    • logback-classic
    • None
    • Windows 10 64-bit

      Visual Studio Build Tools 2019

      Micronaut 2.2.3

      GraalVM CE 20.3.0

      Logback 1.2.3

    Description

      Hi, I'm getting error while creating native-image with Micronaut and GraalVM. ConsoleAppender only is working fine. But with AsyncAppender and/or RollingFileAppender, the following error appears. There is existing issues discussed in this link 
      https://github.com/micronaut-projects/micronaut-core/issues/3683

      logback.xml

      <configuration>
      <property name="log.dir" value="log" />
      <property name="line.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS XXX} %-5level %thread %logger{36} %msg%n" />
      <property name="file.pattern" value="app_%d{yyyyMMdd_}_%i.log" />
      <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
      <encoder><pattern>${line.pattern}</pattern></encoder>
      </appender>
      <appender name="CONSOLE_ASYNC" class="ch.qos.logback.classic.AsyncAppender">
      <appender-ref ref="CONSOLE" />
      </appender>
      <root level="INFO">
      <appender-ref ref="CONSOLE" />
      <!-- <appender-ref ref="FILE" /> -->
      </root>
      <logger name="test" level="TRACE" />
      </configuration>

       

      native-image

      >native-image --no-server --no-fallback --static --class-path build\libs\test-0.0.1-all.jar test.Main
      Warning: Ignoring server-mode native-image argument --no-server.
      [test.main:19224] classlist: 2,344.53 ms, 0.96 GB
      [test.main:19224] (cap): 4,023.40 ms, 0.96 GB
      [test.main:19224] setup: 6,241.80 ms, 0.96 GB
      [test.main:19224] (clinit): 1,257.96 ms, 5.20 GB
      [test.main:19224] (typeflow): 21,101.03 ms, 5.20 GB
      [test.main:19224] (objects): 22,628.06 ms, 5.20 GB
      [test.main:19224] (features): 1,918.00 ms, 5.20 GB
      [test.main:19224] analysis: 49,171.54 ms, 5.20 GB
      Error: Detected a started Thread in the image heap. Threads running in the image generator are no longer running at image runtime. To see how this object got instantiated use --trace-object-instantiation=ch.qos.logback.core.AsyncAppenderBase$Worker. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
      Detailed message:
      Trace: Object was reached by
      reading field java.util.concurrent.locks.AbstractQueuedSynchronizer$Node.thread of
      constant java.util.concurrent.locks.AbstractQueuedSynchronizer$Node@7898fa69 reached by
      reading field java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.firstWaiter of
      constant java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@8eb5f0 reached by
      reading field java.util.concurrent.ArrayBlockingQueue.notEmpty of
      constant java.util.concurrent.ArrayBlockingQueue@487133c7 reached by
      reading field ch.qos.logback.core.AsyncAppenderBase.blockingQueue of
      constant ch.qos.logback.classic.AsyncAppender@658264fb reached by
      reading field ch.qos.logback.core.status.StatusBase.origin of
      constant ch.qos.logback.core.status.InfoStatus@72d5d50d reached by
      indexing into array
      constant java.lang.Object[]@795ec0cf reached by
      reading field java.util.ArrayList.elementData of
      constant java.util.ArrayList@1674196a reached by
      reading field ch.qos.logback.core.BasicStatusManager.statusList of
      constant ch.qos.logback.core.BasicStatusManager@8cc9763 reached by
      reading field ch.qos.logback.core.ContextBase.sm of
      constant ch.qos.logback.classic.LoggerContext@55278968 reached by
      reading field ch.qos.logback.classic.Logger.loggerContext of
      constant ch.qos.logback.classic.Logger@763dead4 reached by
      scanning method io.micronaut.context.DefaultBeanContext.lambda$null$49(DefaultBeanContext.java:2089)
      Call path from entry point to io.micronaut.context.DefaultBeanContext.lambda$null$49(BeanType, Optional, Function, BeanType):
      at io.micronaut.context.DefaultBeanContext.lambda$null$49(DefaultBeanContext.java:2068)
      at io.micronaut.context.DefaultBeanContext$$Lambda$720/0x00000007c1532c40.test(Unknown Source)
      at com.oracle.svm.reflect.Predicate_test_d1a7993465a57621e038e1464fe9f954660d921a_577.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Method.java:566)
      at java.util.ServiceLoader$ProviderImpl.invokeFactoryMethod(ServiceLoader.java:736)
      at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:719)
      at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:190)
      at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:143)
      at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:330)
      at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)

      Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
      Error: Image build request failed with exit status 1

       

      Attachments

        Activity

          People

            logback-dev Logback dev list
            azmankudus Azman Kudus
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: