chesnokoff commented on code in PR #11615:
URL: https://github.com/apache/ignite/pull/11615#discussion_r1834361455
##########
modules/core/src/test/java/org/apache/ignite/logger/java/JavaLoggerTest.java:
##########
@@ -84,4 +207,13 @@ public void testLogInitialize() throws Exception {
assert !log.fileName().contains("%");
assert log.fileName().contains("other-app");
}
+
+ /**
+ * Configure java.util.logging.config.file property
+ */
+ private void setJavaLoggerConfig() throws IOException {
+ File file = new File(U.getIgniteHome(), LOG_CONFIG_DEBUG);
+ System.setProperty("java.util.logging.config.file", file.getPath());
+ LogManager.getLogManager().readConfiguration();
Review Comment:
LogManager reads the property when `Logger.getLogger` method is called first
time.
The problem is that it happens before `System.setProperty`
Firstly, it happens because JavaLoggerTest extends GridCommonAbstractTest
which initialize IgniteUtils and IgniteUtils calls Logger.getLogger
Secondly, `U.getIgniteHome()` also calls initialization of IgniteUtils and
it calls `Logger.getLogger` again.
So `Logger.getLogger` is called before setProperty and that's why jul won't
read this property without explicit configuration.
https://github.com/apache/ignite/blob/67e28313e9ad01033d747e79d0bd9e121b22ad49/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java#L319
--
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]