Closed mathieucarbou closed 3 years ago
@mathieucarbou One option might be to throw an IllegalStateException or some other RuntimeException from ServerConfiguration.getLogsLocation(). This will suppress all logging and write help to stdout directly. Let me know if you want this implemented this way.
@mathieucarbou One option might be to throw an IllegalStateException or some other RuntimeException from ServerConfiguration.getLogsLocation(). This will suppress all logging and write help to stdout directly. Let me know if you want this implemented this way.
IMO there shouldn't be any processing done at all when -help
is on the CLI.
When this flag is there, we should exit immediately after displaying the user help and not do any processing at all especially not the logging since logging is supposed to be based on a potential user configuration (directory).
This is how all the other CLI work.
@mathieucarbou One option might be to throw an IllegalStateException or some other RuntimeException from ServerConfiguration.getLogsLocation(). This will suppress all logging and write help to stdout directly. Let me know if you want this implemented this way.
IMO there shouldn't be any processing done at all when
-help
is on the CLI.When this flag is there, we should exit immediately after displaying the user help and not do any processing at all especially not the logging since logging is supposed to be based on a potential user configuration (directory).
This is how all the other CLI work.
@myronkscott : looking at the code, right now, -help
triggers an early exception thrown from DynamicConfigConfigurationProvider
in the initialize
method:
So we cannot even reach ServerConfiguration.getLogsLocation()
.
@mathieucarbou One option might be to throw an IllegalStateException or some other RuntimeException from ServerConfiguration.getLogsLocation(). This will suppress all logging and write help to stdout directly. Let me know if you want this implemented this way.
IMO there shouldn't be any processing done at all when
-help
is on the CLI. When this flag is there, we should exit immediately after displaying the user help and not do any processing at all especially not the logging since logging is supposed to be based on a potential user configuration (directory). This is how all the other CLI work.@myronkscott : looking at the code, right now,
-help
triggers an early exception thrown fromDynamicConfigConfigurationProvider
in theinitialize
method:So we cannot even reach
ServerConfiguration.getLogsLocation()
.
To correctly fix the problem, I would fix the ordering in the core Bootstrap
class:
IMO, we should have in order:
setup.initialize()
writeVersion(...)
, writePID()
, etcimpl.start()
Moving
writeVersion(setup.getProductInfo());
writePID();
just before
writeSystemProperties();
would probably solve the issue ?
Right now, this is a sort of chicken and egg problem because some methods are extracting and display information from an "not-yet-initialized" environment where CLI parameters have not yet been parsed.
@myronkscott : I don't really like the fact that
-help
is polluted by the logging in INFO.@tmesic99: as a workaround right now I have reduced the extension description (1 line instead of 4)
I have also refactored the implementations to support exposing more information, which I will use for next PR for TDB-5308
New help output