Skip to content
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

#87 Grouping stack traces into single log statements for sub-processes #90

Open
wants to merge 46 commits into
base: master
Choose a base branch
from

Conversation

dean-e-clark
Copy link

@dean-e-clark dean-e-clark commented Sep 8, 2016

Proposed solution to #87

It will group typical Java stack traces into single log statements rather than one log statement per line.

@dmarkov
Copy link

dmarkov commented Sep 9, 2016

@dean-e-clark Thanks, I will ask someone to do a code review here, thanks for your pull request

@dmarkov
Copy link

dmarkov commented Sep 9, 2016

@mkordas this pull request is for you, please review

@dean-e-clark
Copy link
Author

dean-e-clark commented Sep 9, 2016

@mkordas I see this failed the CI builds for styling reasons. Is there a comprehensive list of the styling rules somewhere?

@mkordas
Copy link

mkordas commented Sep 9, 2016

@dean-e-clark I'll help you today :)

@mkordas
Copy link

mkordas commented Sep 9, 2016

@dean-e-clark first of all, PR description must contain link to the issue, can you fix it?

@@ -107,6 +107,16 @@
private transient boolean closed;

/**
* Maximum number of log lines for a stack trace
*/
public static final int DEFUALT_MAX_LENGTH = 1000;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dean-e-clark public static final should not be used at all: http://www.yegor256.com/2015/07/06/public-static-literals.html

@mkordas
Copy link

mkordas commented Sep 9, 2016

@dean-e-clark

I see this failed the CI builds for styling reasons. Is there a comprehensive list of the styling rules somewhere?

There is no one list, it's just set of hundreds of various checks done by Qulice

@@ -420,6 +444,34 @@ private static void close(final Closeable res) {
this.output = out;
this.level = lvl;
}

/**
* Checks if line is part of a stack trace and should be appended.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dean-e-clark does it mean that stactraces can have just these 3 prefixes and otherwise they are not stacktraces?

Copy link
Author

@dean-e-clark dean-e-clark Sep 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkordas It's not what they start with, but it's what comes after the initial line

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dean-e-clark OK, thanks for explaining

/**
* Example application to help test {@link VerboseProcess}.
* @author Dean Clark ([email protected])
* @version $Id$
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dean-e-clark we also need @since tag here

* Provides all captured logging events.
* @return Copy of log list
*/
public final List<LoggingEvent> getLogs() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try {
process.stdout();
} catch (final IllegalArgumentException ex) {
failed = true;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dean-e-clark instead of 3 lines around faled we could have just one line with Assert.fail just after process.stdout();

);
MatcherAssert.assertThat(
ex.getMessage(),
Matchers.containsString(VerboseProcessExample.SYSOUT_2)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dean-e-clark these assertions could be joined, Hamcrest supports composition

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkordas I'll give that a go, but I have a feeling it will result in another PMD violation or something

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dean-e-clark why you think so? There shouldn't be any problems with it :)

@mkordas
Copy link

mkordas commented Sep 14, 2016

@dean-e-clark see my comments, it's getting better and better 😃

} else {
finalpath = String.format("%s%s", rootpath, "/bin/java");
}
final File file = new File(finalpath);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dean-e-clark this variable can be inlined as well

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkordas that would make the require duplicated nested-ifs

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dean-e-clark I don't see how inlining could cause any problems here, can you please explain?

* @param input String to strip
* @return Stripped string
*/
private static String stripStart(final String input) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dean-e-clark this method should be named like a noun, please read http://www.yegor256.com/images/books/elegant-objects/seven-pages.pdf

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkordas removed this in favor of String.trim()

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dean-e-clark I don't see your changes, can you please push them?

@mkordas
Copy link

mkordas commented Sep 26, 2016

@dean-e-clark how is it going here? There are still some comments open

@mkordas
Copy link

mkordas commented Oct 10, 2016

@dean-e-clark I've responded to some your questions, but still many comments are open - let's finish this one finally :)

@mkordas
Copy link

mkordas commented Nov 13, 2016

@dean-e-clark do you want to finish this one?

@mkordas
Copy link

mkordas commented Nov 21, 2016

@dean-e-clark ping

@dean-e-clark
Copy link
Author

dean-e-clark commented Nov 22, 2016

@mkordas Sorry, on an extended vacation until the 28th. Will try to find some time
to address the remaining comments in the next couple if days though.

@mkordas
Copy link

mkordas commented Nov 29, 2016

@dean-e-clark it's 29th today, will you find some time this week? Not much is left I suppose :)

@dean-e-clark
Copy link
Author

dean-e-clark commented Nov 29, 2016 via email

@dean-e-clark
Copy link
Author

dean-e-clark commented Dec 1, 2016

@mkordas AppVeyor seems to be broken, but I've made the other requested changes and the Travis CI build looks good

@dean-e-clark
Copy link
Author

@mkordas You still around?

@NaanProphet
Copy link

NaanProphet commented Jan 4, 2017

@mkordas happy new year! really exciting to see the work on this issue. wondering if we're close to merging the fix in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants