davsclaus opened a new pull request, #28765: URL: https://github.com/apache/camel/pull/28765
_Claude Code on behalf of davsclaus_ [CAMEL-26435](https://issues.apache.org/jira/browse/CAMEL-26435), part of the startup work of [CAMEL-23810](https://issues.apache.org/jira/browse/CAMEL-23810), after #28762, #28763 and #28764. **Depends on #28763**: `LauncherStartupLoggingTest.camelVersionDoesNotConfigureLog4j` passes only once `camel version` stops creating the commands of the plugins (#28763). The TUI plugin creates a logger when its commands are created. This PR stays a draft until #28763 is merged and this branch is updated. ## Changes - **The self-update check no longer configures log4j.** Before each command, the check calls `InstallDetector.webInstallerVersionsRoot()`, which called `FileUtil.isWindows()`. `FileUtil` has a static slf4j logger, so loading it configured log4j in full, with its JMX MBeans, before the command ran. That cost about 140 ms on every command, and undid #28764 (a command that turns the logging off configures log4j only when something logs). `InstallDetector` now checks `os.name` itself, as `TerminalWidthHelper` does. - **`camel.sh` and `camel.bat` read the Java version from the JDK's `release` file** (`bin/../release`, `JAVA_VERSION="25.0.5"`) instead of starting a JVM for `java -version`, about 25 ms on macOS (starting a process costs more on Windows). Without a `release` file, or without a version in it (a `java` on the `PATH` that is a link, for example), the scripts run `java -version` as before. Both scripts follow the same discovery contract. ## Startup `camel version` through the launcher main, self-update check on, JDK 25, M4 Pro, median of 9 runs, with #28763 merged in: | | Before | After | | --- | --- | --- | | `camel version` | 310 ms | 175 ms | | `camel ps` | 310 ms | 172 ms | Plus about 25 ms from `camel.sh`. ## Tests - New `LauncherStartupLoggingTest` runs `camel version`, and the self-update check of a web-installer install, each in a new JVM, and checks the classes the JVM loaded: no slf4j class (no logger was created) and no log4j appender (log4j was not configured). Both cases fail without the fix. The web-installer case uses a fresh update-check cache, so it makes no network call. - `CamelShDiscoveryTest` (runs on Linux and macOS): the version comes from the `release` file (a fake `java -version` prints garbage), an old version in the `release` file is rejected, and a `release` file without a version falls back to `java -version`. `CamelBatDiscoveryTest` (runs on Windows, in the windows-validator job) has the first two. Its existing tests use the real JDK, which has a `release` file, so they now exercise the new path as well. - Locally: camel-launcher `LauncherStartupLoggingTest`, `CamelShDiscoveryTest`, `UpdateCheckerTest` (43 tests) pass with #28763 merged in; camel-jbang-core `InstallDetectorTest` (14) passes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0128ThHB3iQdrvSRLVBGRrdP -- 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]
