-
Notifications
You must be signed in to change notification settings - Fork 867
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
#623: suppress logging null/empty lines #655
base: master
Are you sure you want to change the base?
Conversation
Note: this issue doesn't specifically affect the maven build, but build tools such as Jenkins look through the maven build log for "[ERROR]" and will incorrectly treat the build as failing due to this false flag. |
Please @eirslett Merge this change as I'm facing false ERROR logs in Maven running a 'npm install' on Ubuntu 17.10 with Node v8.9.4 (no errors running on command line). |
@eirslett , any thoughts on when/why this change can/cannot be merged? |
This isn't really a problem with the Maven plugin. It's a problem with npm, which logs to stderr, when it should have been logging to stdout. And it's a problem with Jenkins, which should determine build status based on exit code, not on contents of the build log. |
Since the change just flags an empty log as passing. I'm not sure under which condition that an empty log would be an error if no exception or error was provided. |
There's a number of reasons why you would want to log empty lines, especially readability-wise. If you need to log an error and display an ascii diagram for example, or separate paragraphs of text in a lengthy error report? |
We see a lot of empty error lines too, since we switched to yarn/babel/webpack. That's not breaking our Jenkins builds, but it doesn't help anything either. Maybe we could make a compromise to not supress empty lines, but instead logging them to info instead of error. What do you think? |
I'm still reluctant, I don't think it' this plugin's responsibility to supporess empty lines. Maybe it should be fixed in yarn instead? You could argue that they shouldn't be logging empty stderr lines in the first place. If you build is set up fail fail if it finds the string "Error" in the log, then it would still appear if you ran yarn/babel/webpack, I suppose? Anyways, it's not good practice to fail a build on conditions like that, the proper way is to use process exit codes. Exit code 0 = success, all others = failure. |
I totally agree with you and your arguments, but maybe I can give you an example, why it would be helpful if this plugin is not logging (false) errors: |
I think neither node or java is wrong, rather, there are mismatches in the int ranges, that presents certain logging levels in each language(and possible logging libs in each). In my opinion, trying to patch it this way won't scale. |
Summary
Suppress logging blank/null lines, which eliminates the blank error line that can sometimes appear as reported in issue #623 .
You may wish to move the if check for null/empty strings to the top of the function to suppress false info messages as well, but I leave that to you.
Tests and Documentation
I ran the modified version across multiple builds locally and all false errors disappeared, while allowing valid warnings/errors to be reported as before.