Open krisgerhard opened 11 months ago
I actually observed this in production but managed to reproduce with integration tests.
Reproducer patch 👇
Command used to run tests: ./mvnw verify -Pnative-image -Dquarkus.native.container-build=true
Index: integration-tests/pom.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
--- a/integration-tests/pom.xml (revision 2640eed0ec467283dc4542da4ff19ed4006d3c31)
+++ b/integration-tests/pom.xml (date 1701419293942)
@@ -58,6 +58,9 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>${native.surefire.skip}</skipTests>
+ <environmentVariables>
+ <LG_PRE>LOGBACK</LG_PRE>
+ </environmentVariables>
</configuration>
</plugin>
<plugin>
@@ -74,6 +77,9 @@
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
</systemPropertyVariables>
+ <environmentVariables>
+ <LG_PRE>LOGBACK</LG_PRE>
+ </environmentVariables>
</configuration>
</execution>
</executions>
Index: integration-tests/src/main/resources/logback.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/integration-tests/src/main/resources/logback.xml b/integration-tests/src/main/resources/logback.xml
--- a/integration-tests/src/main/resources/logback.xml (revision 2640eed0ec467283dc4542da4ff19ed4006d3c31)
+++ b/integration-tests/src/main/resources/logback.xml (date 1701287842133)
@@ -4,11 +4,11 @@
<file>target/tests.log</file>
<append>false</append>
<encoder>
- <pattern>LOGBACK- %-5level %msg %n</pattern>
+ <pattern>${lg.pre}- %-5level %msg%n</pattern>
</encoder>
</appender>
<root level="trace">
<appender-ref ref="FILE" />
</root>
-</configuration>
\ No newline at end of file
+</configuration>
Could be related to https://github.com/quarkusio/quarkus/issues/37273
@stuartwdouglas Is there a way to set these values in runtime in native mode using env variables? As i understand config expansion is done during static initialization :/
I think we would need to move logback initialization from static init to runtime init. I am not sure what the effects of such a change would be without trying it out.
@stuartwdouglas Have you found time for this issue? :)
Workaround is to supply this environment variable during build time.
In order to do it for container build, you need to pass quarkus.native.additional-build-args
quarkus.native.additional-build-args=-J-Dlg.pre=LOGBACK
in application.properties
etc.
Variables in logback.xml are being replaced fine from application.properties but not from environment variables. Works in JVM mode but not in native mode.