-
Notifications
You must be signed in to change notification settings - Fork 397
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
Write out newline character after the message in verbose output #5135
Conversation
Suggesting @dsouzai for review. |
@genie-omr build all |
The change looks reasonable to me. However, it is worth pointing out its impact. I think I know the reason why the newline was put in the beginning of the line. It's not a good one lol, but essentially, in OpenJ9, there's times when the vlog data is written out as
and so to reduce the "overhead" of writing out the newline explicitly, the Searching through the code, I also found this [1]
Notice how we do |
Thanks for pointing this out. To fix such a location we would just do:
Is this correct? I have no problem going through all the locations and fixing this up so we have conventional printing and not catch users off guard. Do you think this is feasible? |
Yeah looks correct.
Yeah i don't think there's too many locations where we do this. Probably could just grep for |
Uuuups. Accidentally clicked close button. Meant to say thanks for the feedback and I'll turn this into WIP: until we address this. |
@dsouzai issues have been addressed. Ready for another review. |
@mpirvu perhaps you would take a look since you are probably one of the biggest verbose log users? |
7b80420
to
813431b
Compare
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.
lgtm
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.
LGTM. Not directly related to this PR, I have an inline question about some write
statements without a preceding lock.
@genie-omr build all |
@fjeremic this looks like it should be close to being ready - do we need to warn/help migrate any downstream consumers like OpenJ9 to avoid breaking the logging? |
Yes, this is done in eclipse-openj9/openj9#9391. |
The `TR_VerboseLog::writeLine*` APIs currently write the newline character before the message being printed which is non-conventional. Typically the expectation of a user is that any API that outputs newline characters outputs them at the end, examples from various languages in [1] [2] [3], and there are numerous other examples. The reason we are making this change is because other components in OMR will expect to be writing at the start of a newline, whether that be stdout, stderr, or a file. The verbose log not adhering to this expectation yields in messages getting printed one after another which is not desirable. [1] https://docs.python.org/3/library/functions.html#print [2] https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html#println-java.lang.String- [3] https://docs.microsoft.com/en-us/dotnet/api/system.console.writeline?view=netframework-4.8#System_Console_WriteLine_System_String_ Signed-off-by: Filip Jeremic <[email protected]>
We perform the following changes: - Update `write` calls to `writeLine` calls where possible - Update newline convention to print the new line at the end - Use the tag when printing where possible - Add lock acquire and release where it is missed Signed-off-by: Filip Jeremic <[email protected]>
Rebased on the latest branches and I went ahead and generated builds using this PR and compared how the verbose log looks before and after. I carefully analyzed all output of |
@genie-omr build all |
Any committer want to sign up to shepherd this one? |
@0xdaryl @Leonardo2718 any takers for this one perhaps (and the OpenJ9 change)? |
The
TR_VerboseLog::writeLine*
APIs currently write the newlinecharacter before the message being printed which is non-conventional.
Typically the expectation of a user is that any API that outputs
newline characters outputs them at the end, examples from various
languages in [1] [2] [3], and there are numerous other examples.
The reason we are making this change is because other components in OMR
will expect to be writing at the start of a newline, whether that be
stdout, stderr, or a file. The verbose log not adhering to this
expectation yields in messages getting printed one after another which
is not desirable.
[1] https://docs.python.org/3/library/functions.html#print
[2] https://docs.oracle.com/javase/8/docs/api/java/io/PrintStream.html#println-java.lang.String-
[3] https://docs.microsoft.com/en-us/dotnet/api/system.console.writeline?view=netframework-4.8#System_Console_WriteLine_System_String_
Signed-off-by: Filip Jeremic [email protected]