You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the following exception is thrown (important lines marked):
Error: Detected a started Thread in the image heap. Threads running in the image generator are no longer running at image runtime. Object has been initialized by the io.micronaut.runtime.Micronaut class initializer with a trace:
at java.lang.Thread.<init>(Thread.java:708)
at java.util.concurrent.Executors$DefaultThreadFactory.newThread(Executors.java:660)
at ch.qos.logback.core.util.ExecutorServiceUtil$1.newThread(ExecutorServiceUtil.java:42)
at java.util.concurrent.ThreadPoolExecutor$Worker.<init>(ThreadPoolExecutor.java:630)
at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:920)
at java.util.concurrent.ThreadPoolExecutor.ensurePrestart(ThreadPoolExecutor.java:1593)
at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:346)
at java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate(ScheduledThreadPoolExecutor.java:632)
--> at io.micronaut.aws.cloudwatch.logging.CloudWatchLoggingAppender.start(CloudWatchLoggingAppender.java:161)
at ch.qos.logback.core.joran.action.AppenderAction.end(AppenderAction.java:90)
at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:309)
at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:193)
at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:179)
at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:165)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:152)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:64)
at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:134)
at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:388)
--> at io.micronaut.runtime.Micronaut.<clinit>(Micronaut.java:53)
The issue is caused because native image doesn't support thread creation during build time and the the appended calls scheduleAtFixedRate in the CloudWatchLoggingAppender. The appender needs to be started during build time in this case as loggers are required by Micronaut, ApplicationContext and other core classes, and the logger starts all the appenders on creation.
The text was updated successfully, but these errors were encountered:
* Fix native image build with CloudWatchLoggingAppender
- Start the thread to send logs to cloudwatch only when append command is called, so it is not started during build time
- Create dispatchOnStart property to return to previous behavior
* Modify CloudWatchLoggingAppender tests
Issue description
Reproduce
src/main/resources/logback.xml
to be the following:./gradlew nativeRun
Error
With the configuration in
build.gradle
:the following exception is thrown (important lines marked):
The issue is caused because native image doesn't support thread creation during build time and the the appended calls scheduleAtFixedRate in the CloudWatchLoggingAppender. The appender needs to be started during build time in this case as loggers are required by
Micronaut
,ApplicationContext
and other core classes, and the logger starts all the appenders on creation.The text was updated successfully, but these errors were encountered: