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
JBEAP-26480: add --debug option to CLI #553
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.
You can use LogManager.getLogManager()
to get loggers as well.
This doesn't work when using the prospero distribution (dist/build/target
). Either the default logging configuration needs to include a console handler set to level OFF, or the code needs to add the console handler.
aa643d2
to
7c0d838
Compare
Updated.
Yeah, but my problem was that we could only access loggers this way. E.g. I cannot directly do Btw, is the |
No -Pdist builds feature packs and provisions the standalone feature pack to create a distribution of prospero. |
@@ -105,6 +109,16 @@ public static CommandLine createCommandLine(CliConsole console, String[] args, A | |||
|
|||
commandLine.setParameterExceptionHandler(new UnknownCommandParameterExceptionHandler(rootParameterExceptionHandler, System.err)); | |||
|
|||
final boolean isDebug = Arrays.stream(args).anyMatch(CliConstants.DEBUG::equals); | |||
if (isDebug) { | |||
LogContextConfiguration lcc = ((PropertyConfigurator) org.jboss.logmanager.Logger.getLogger("").getAttachment(Configurator.ATTACHMENT_KEY)) |
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.
sorry one more nitpick - could you handle a case when the attachement cannot be case to PropertyConfigurator or is null? I think we should just print an error message, but continue the execution in that case, WDYT?
7c0d838
to
8fe7967
Compare
Right, what I'm saying is that if I run -Pdist it generates 3 files - zip, tar.gz and jar. I've added the check, as far as I can tell it will only fail if someone deletes the properties file. You want this ported to 1.1.x too? |
Ah sorry I misunderstood you. Yes the jar is empty, I'm not sure if it's possible to disable building it
Yes please if you don't mind |
Thanks @michpetrov |
Issue: JBEAP-26480
Feels like there should be better way to get a hold of the console handler but I haven't found any.