-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
MNG-7875 colorize transfer messages #1231
Conversation
maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java
Outdated
Show resolved
Hide resolved
e90af14
to
a6de9b0
Compare
Not sure it is easier to read, what about keeping them at debug/fine level and use something maven oriented by default (info: The fact it does not use a logger already messes up the output depending the build mode and mojos (due to stdout usage directly) so maybe migrate to slf4j impl first then use the levels and be it, looks better to solve the issue than working it around with colors which don't really enhance it for end users in the previous mentionned case(s). |
using slf4j vs console is completely orthogonal: it does not change anything to this issue. Don't hesitate to open a Jira and a PR in parallel on
for sure, it's done as pure color enhancement, absolutely not any other change: then data exactly is the same, just color to help see the important different fields and cases ask a normal user about the difference between "Downloading" and "Downloaded", ask about the url structure I know this output is new and made by someone else: take time to use it and see live why it was done the way of was done... |
maven-embedder/src/main/java/org/apache/maven/cli/transfer/AbstractMavenTransferListener.java
Outdated
Show resolved
Hide resolved
@@ -184,14 +189,19 @@ protected AbstractMavenTransferListener(PrintStream out) { | |||
|
|||
@Override | |||
public void transferInitiated(TransferEvent event) { | |||
String darkOn = MessageUtils.isColorEnabled() ? ANSI_DARK_SET : ""; |
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.
If we want to cut logging (and I do agree with @elharo we log way too much), I'd just remove this method (make it no op).
Or just leave it for PUT (leave it as before), and do not log for the rest.
Reason is simple: if you have 5 reposes, you will have 5 "Downloading...." but only one "Downloaded", and the latter matter.s
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.
This should be a separate discussion. Foe this we have other listeners.
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.
this line is not about cutting logging: it's about adding color when color enabled
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.
Well JIRA currently states following:
transfer message are currently hard to read for many users
(logging example cut for brevity)
- it's interweaved into normal build messages
- users don't really see the difference between "Downloading" (transfert started, may eventually fail with 404) and "Downloaded" (done successfully)
- repository id is not so visible in the middle of the message
- the download url has much info in it to see: base url, groupId as directory, artifactId, version, and filename
So, based on this above, I assumed, that: is interweave and too chatty, so cut it down, and if "users don't see the difference", they are right: As I said, this logger when 5 repositories are defined will emit 5 "Downloading" and 1 "Downloaded", and the one "Downloaded" matters, the 5 "Downloading" does not (better check with effective-pom what reposes you have instead to repeat it to each artifact you need to download).
Unsure how JIRA comes to conclusion based on these 4 bullets above "ok, let's color it!", when it is ONLY solving the last bullet (is not solving it actually, as when this listener is involved, layout is already applied, and we do not speak about "artifacts" but about "resources" that are resolved against some baseUrl/repository, so this is another problem).
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.
This should be a separate discussion. Foe this we have other listeners.
What other listeners we have for this? WDYM?
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.
As we know, by default Maven "leaks" your artifact paths, and only reason "Downloading" log line is useful is only this one: it makes user aware Maven is making HTTP request against the logged baseUrl. OTOH, due overwhelming amount of Maven logging, this information is usually lost, due log-noise.
To properly fix "leaking", use RRF but that is another thing.
Yes and no, using colors does not solve the issue you mention for me, using loggers is a proposal so somehow it does IMHO.
We can for 2 reasons:
Agree, this is why I said it would be debug level cause most of the time it is not but if needed it can be enabled with --loggin-level which sounds like solving the issue you reference for me.
Why? you can reference it in the mesage but it stays readable compared to an url randomized on the output.
Ok, I disagree on that point for the two mentionned reasons
This is why for me it is not better, several cases will not have colors, contrast will not always make it better - can make it worse btw - and length stays the same.
Feedback I encountered were, rest was either "it is too verbose but I filtered it after or it was ok":
I appreciate the proposal but my point is I think it does not address the referenced ticket at the end - and I'm saying that after being one to think about that some years ago - was with sed to add colors at that time. Just trying to ensure we dont mark resolved a ticket we didnt address. |
disagree on everything: the PR does what the Jira title and description say = color to ease understanding your expectations are different, probably complementary, then to be done separately if you need it: going to slf4j will have other independent impact |
@hboutemy not imposing anything, was just sharing my feedback that I think this PR is a noop regarding the goal which is something I share. Due to the regular feedback we have on this part I don't think this step is that useful and I think we can skip it but no issue for me if you want to merge it - code is more than ok. It is just it does not reach its real goal and just push back the actual issue IMHO so thought it would be worth thinking to a global solution instead of a quick workaround. |
the goal of this PR is https://issues.apache.org/jira/browse/MNG-7875 (please take time to read it), then this PR reaches its goal if there is another goal (and I understand there is), please open a Jira issue describing the goal: I don't get fully this other goal. And of course, this PR does not try to address this other goal |
If the problem is "transfer message are currently hard to read for many users" I must confess that I agree that adding color make them not easier to read (for me as a user).... and maybe one should better try to enhance the message? |
Another possibility would be to implement something different when in interactive mode:
As a user, I'm usually not interested in knowing which exacts artifacts are downloaded, but mainly by the fact that the build is actually downloading artifacts. |
...completely agree, except with this last line (where am more at @hboutemy side): baseUrl used in download is good to be visible, as a cautious developer can catch from very first few lines of downloads if the env is not right (ie. mirror not properly set up, etc). This is why I keep saying that am personally uninterested in the "Downloading..." line, but am very interested in "Downloaded..." line. Thinking more, I kinda agree with @gnodet to keep build logs unspoiled with downloading/downloaded lines (just to have some deleted line, so progress should be visible), and maybe at the build end (a la validation) have some summary table? Like by repoId/baseUrl/countOfDowmloads? Basically, current Maven logging could be called "detailed" (as Maven 3.9.x behaves today), and introduce something like |
Please note that we do have different listeners already which are activated through other flags indirectly. |
Can you elaborate? I already asked you about it: #1231 (comment) |
Also, I am willing to accept following PR:
|
Look at impl if the interface. We have for nop, slf4j, no progress and this one for the tty. |
a6de9b0
to
43f6cef
Compare
dropped the layout-specific colorization as asked |
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.
Please provide updated screenshots.
https://issues.apache.org/jira/browse/MNG-7875
![MNG-7875_before_output](https://private-user-images.githubusercontent.com/237462/266867238-06fd0920-1e16-4e7f-812a-db339e1f292b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMzNjU1NzksIm5iZiI6MTcyMzM2NTI3OSwicGF0aCI6Ii8yMzc0NjIvMjY2ODY3MjM4LTA2ZmQwOTIwLTFlMTYtNGU3Zi04MTJhLWRiMzM5ZTFmMjkyYi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxMVQwODM0MzlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wZjgyYmFiMzA0OTNmMTE5MGMzZjAzNDc2NmNmOWZhN2RhMDc3M2JjYzY0NWUwNDQzZGM2MjliOTdmN2JkODFmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.Dp0AqJxPrBDmtIjSxJLOMHwwLpytIc6MxSgBnf1-kbY)
before:
after:
![MNG-7875_colorized_output_second](https://private-user-images.githubusercontent.com/237462/267087196-9d74cd8e-66d5-4b48-839c-01f3d30a60bf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMzNjU1NzksIm5iZiI6MTcyMzM2NTI3OSwicGF0aCI6Ii8yMzc0NjIvMjY3MDg3MTk2LTlkNzRjZDhlLTY2ZDUtNGI0OC04MzljLTAxZjNkMzBhNjBiZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxMVQwODM0MzlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04MmI3YWU4ZjUwNzRlMmQ5ZjlkNzgyNTY4MzU0YThkM2UwMDUxN2RiZDExNjI5MWI4NmU2N2QzMGI3ZjFmMzI5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.2UzbJSHfWglkNp6T45h7eqqup_dvn-DAgcR8CKsxM7Q)
(initial proposal:
![MNG-7875_colorized_output](https://private-user-images.githubusercontent.com/237462/266846141-56fb3705-01d1-45cd-b249-0dc6f9c62c6c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMzNjU1NzksIm5iZiI6MTcyMzM2NTI3OSwicGF0aCI6Ii8yMzc0NjIvMjY2ODQ2MTQxLTU2ZmIzNzA1LTAxZDEtNDVjZC1iMjQ5LTBkYzZmOWM2MmM2Yy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODExJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgxMVQwODM0MzlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iNmI5YjdjNjBhZWFkZTg5ZjlhODI5YmVhMTIyODU5NTI1YzBmNWI0NGU5ZTFhNDc5NzgzMWJjZjg3M2U1YzEwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.smecKFcPEOuM58w0mOTKfJX6rzPfMhxoJmepl-uSSN0)
)