jbangdev / jbang

Unleash the power of Java - JBang Lets Students, Educators and Professional Developers create, edit and run self-contained source-only Java programs with unprecedented ease.
https://jbang.dev
MIT License
1.4k stars 156 forks source link

--quiet still shows INFO logs for JShell when using Docker #1831

Open loicmathieu opened 1 month ago

loicmathieu commented 1 month ago

Describe the bug When using --quiet only error logs should be displayed. But when using a JShell script two logs are still emitted when launching JBang from Docker:

Aug 16, 2024 12:25:34 PM java.util.prefs.FileSystemPreferences$1 run
NFO: Created user preferences directory.

To Reproduce Create this script in a test.jsh file:

System.out.println("Hello World!");

Launch it via Docker with --quiet:

docker run -v `pwd`:/ws --workdir=/ws -ti jbangdev/jbang-action --quiet test.jsh

Expected behavior No INFO logs should be displayed when running with --quiet in Docker.

JBang version

[jbang] [0:282] jbang version 0.117.1
Cache: /jbang/.jbang/cache
Config: /jbang/.jbang
Repository: /root/.m2/repository
Java: /opt/java/openjdk [11.0.11]
OS: linux
Arch: x64
Shell: bash
0.117.1
quintesse commented 1 month ago

This is actually not JBang giving that message, but it's the JVM itself.

But I'm guessing that the message will always appear on any invocation of a the action so we should probably prevent it from displaying.

The easiest way would be to simply create that folder inside the docker image when the action gets built.

Another option would be to suppress JVM info messages, but I feel that's not something that JBang should be doing (some users might actually want those messages).

loicmathieu commented 1 month ago

The easiest way would be to simply create that folder inside the docker image when the action gets built.

I think it's a good idea ;)