-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(console monitor): Log level can be set via program arg #4476
feat(console monitor): Log level can be set via program arg #4476
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are always happy to welcome new contributors ❤️ To make things easier for everyone, please make sure to follow our contribution guidelines, check if you have already signed the ECA, and relate this pull request to an existing issue or discussion.
core/common/boot/src/main/java/org/eclipse/edc/boot/system/runtime/BaseRuntime.java
Fixed
Show fixed
Hide fixed
Setting the log level should not be done like this, particularly having |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment about redoing this PR.
So you suggest removing the config option? |
It should be set the same way the color arg is done. Only one class needs to be modified for this. |
core/common/boot/src/main/java/org/eclipse/edc/boot/system/runtime/BaseRuntime.java
Outdated
Show resolved
Hide resolved
core/common/boot/src/main/java/org/eclipse/edc/boot/system/runtime/BaseRuntime.java
Outdated
Show resolved
Hide resolved
core/common/boot/src/main/java/org/eclipse/edc/boot/system/runtime/BaseRuntime.java
Outdated
Show resolved
Hide resolved
Thanks for your reviews. I do understand your points. I have two suggestions: With option 2 we can easily add new configs later if we need them (i.e. like a formatter option). We can also change the color option to be configurable that way. |
core/common/boot/src/main/java/org/eclipse/edc/boot/system/ExtensionLoader.java
Outdated
Show resolved
Hide resolved
core/common/boot/src/main/java/org/eclipse/edc/boot/system/ExtensionLoader.java
Outdated
Show resolved
Hide resolved
core/common/boot/src/main/java/org/eclipse/edc/boot/system/ExtensionLoader.java
Outdated
Show resolved
Hide resolved
core/common/boot/src/main/java/org/eclipse/edc/boot/system/runtime/BaseRuntime.java
Outdated
Show resolved
Hide resolved
core/common/boot/src/test/java/org/eclipse/edc/boot/system/ExtensionLoaderTest.java
Outdated
Show resolved
Hide resolved
core/common/boot/src/test/java/org/eclipse/edc/boot/system/ExtensionLoaderTest.java
Outdated
Show resolved
Hide resolved
spi/common/boot-spi/src/main/java/org/eclipse/edc/spi/monitor/ConsoleMonitor.java
Outdated
Show resolved
Hide resolved
As I mentioned, this PR is too complex for what it needs to do. Program arguments can be sourced from environment variables for people who want to create their Docker images that way. There's no need to introduce this behavior in the codebase, and we should never introduce a dedicated configuration source such as a file. Let's keep this as simple as possible and try to only modify the single class. |
@jimmarino @paullatzelsperger @ndr-brt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a pair of nits, ready to go otherwise
core/common/boot/src/main/java/org/eclipse/edc/boot/system/ExtensionLoader.java
Outdated
Show resolved
Hide resolved
core/common/boot/src/main/java/org/eclipse/edc/boot/system/ExtensionLoader.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nits, OK for me otherwise
core/common/boot/src/main/java/org/eclipse/edc/boot/system/ExtensionLoader.java
Outdated
Show resolved
Hide resolved
core/common/boot/src/test/java/org/eclipse/edc/boot/system/ExtensionLoaderTest.java
Outdated
Show resolved
Hide resolved
core/common/boot/src/main/java/org/eclipse/edc/boot/system/ExtensionLoader.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Paul Latzelsperger <43503240+paullatzelsperger@users.noreply.github.com>
@EnumSource | ||
void loadMonitor_programArgsSetConsoleMonitorLogLevel(ConsoleMonitor.Level level) { | ||
|
||
var monitor = ExtensionLoader.loadMonitor(new ArrayList<>(), ConsoleMonitor.LEVEL_PROG_ARG + "=" + level.toString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also test various combinations of spaces, upper, lower case etc.:
"--log-level = INFO"
, "--log-level= INFO"
, "--log-level =INFO"
, "--log-level=info"
,...
This could also be done with a ParamterizedTest
and a @ValueSource
.
Not saying all of these variants should get accepted, IMO it's fine to only accept "--log-level=XYZ"
, but to have a definitive test and to guard against regression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are getting there.
core/common/boot/src/test/java/org/eclipse/edc/boot/system/ExtensionLoaderTest.java
Outdated
Show resolved
Hide resolved
This reverts commit bacc49a.
What this PR changes/adds
This allows to set the log level of the
ConsoleMonitor
via program args (i.e. --log-level=INFO).Why it does that
It was not possible to set the level.
Linked Issue(s)
Closes #4392