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

Rejuvenate log levels #7737

Merged
merged 4 commits into from
Feb 15, 2020
Merged

Conversation

yiming-tang-cs
Copy link
Contributor

@yiming-tang-cs yiming-tang-cs commented Nov 1, 2019

We appreciate your previous feedback and it's very helpful! Here's a reissue of #7170 with a new version of our tool. It takes a long time, sorry for waiting. The tool made many fewer transformations, however, there were a few that we removed that you did not agree with in the original PR. Again, we'd appreciate any feedback and are willing to make further changes if you wish to incorporate our PR into your project.

Settings

We have several analysis settings. We can vary these settings and rerun if you desire. The settings we are using in this pull request are:

Treat CONFIG levels as a category and not a traditional level, i.e., our tool ignores these log levels.
Never lower the logging level of logging statements within catch blocks.
Never lower the logging level of logging statements within if statements.
Never lower the logging level of logging statements containing certain (important) keywords.
Never raise the logging level of logging statements without particular keywords in their messages.
Avoid log wrapping by disregarding logging statements contained in if statements mentioning log levels.
The greatest number of commits from HEAD evaluated: 1000.
The head at the time of analysis was: a49fb60

Copy link
Member

@shs96c shs96c left a comment

Choose a reason for hiding this comment

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

Thank you for the updated PR. I've added comments explaining why the levels are the way they are for those places where I feel that the tool has erred. If those are cleaned up, I'd be happy to merge the remaining changes :)

@@ -76,7 +76,7 @@ private static URL getServiceUrl() {
.findFirst().orElseThrow(WebDriverException::new);

service = (EdgeDriverService) builder.withVerbose(true).withLogFile(logFile.toFile()).build();
LOG.info("edgedriver will log to " + logFile);
LOG.fine("edgedriver will log to " + logFile);
Copy link
Member

Choose a reason for hiding this comment

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

This is deliberately at this level.

@@ -80,7 +80,7 @@ public Connection(HttpClient client, String url) {
serialized.put("sessionId", sessionId);
}

LOG.info(JSON.toJson(serialized.build()));
LOG.finest(JSON.toJson(serialized.build()));
Copy link
Member

Choose a reason for hiding this comment

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

Right now this is experimental and deeply flaky. We left this at info to make debugging user reports a lot easier.

@@ -40,7 +40,7 @@ public void build(String target) {
if (target == null || "".equals(target)) {
throw new IllegalStateException("No targets specified");
}
log.info("\nBuilding " + target + " ...");
log.finest("\nBuilding " + target + " ...");
Copy link
Member

Choose a reason for hiding this comment

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

This is to let people know that the tooling is doing something during a build. Please leave.

@@ -110,7 +110,7 @@ public HttpResponse execute(HttpRequest req) throws UncheckedIOException {
StringBuilder printableArgs = new StringBuilder("[");
Joiner.on(", ").appendTo(printableArgs, args);
printableArgs.append("]");
LOG.info(String.format("Command request: %s%s on session %s", cmd, printableArgs, sessionId));
LOG.finest(String.format("Command request: %s%s on session %s", cmd, printableArgs, sessionId));
Copy link
Member

Choose a reason for hiding this comment

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

info was chosen deliberately to mirror the old behaviour that users expected.

@@ -58,7 +58,7 @@ public void start() {
public void stop(Duration timeout) {
Objects.requireNonNull(timeout);

LOG.info("Stopping " + getId());
LOG.warning("Stopping " + getId());
Copy link
Member

Choose a reason for hiding this comment

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

It's not a warning. It's an informational message.

@@ -93,7 +93,7 @@ public Image pull(String name, String tag) {
throw new WebDriverException("Unable to pull container: " + name);
}

LOG.info(String.format("Pull of %s:%s complete", name, tag));
LOG.fine(String.format("Pull of %s:%s complete", name, tag));
Copy link
Member

Choose a reason for hiding this comment

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

Waiting for the pull takes a long time. This message informs the user that at least one of the images being pulled is available. Please leave.

@@ -70,7 +70,7 @@ private void addSystemDrivers(
Capabilities caps = info.getCanonicalCapabilities();
builders.stream()
.filter(builder -> builder.score(caps) > 0)
.peek(builder -> LOG.info(String.format("Adding %s %d times", caps, info.getMaximumSimultaneousSessions())))
.peek(builder -> LOG.finest(String.format("Adding %s %d times", caps, info.getMaximumSimultaneousSessions())))
Copy link
Member

Choose a reason for hiding this comment

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

This is an informational message that allows someone to read the console output and understand how the grid node is configured. Please leave.

@@ -74,7 +74,7 @@ private Routable getRcHandler(ActiveSessions sessions) {
getClass().getClassLoader())
.asSubclass(Routable.class);
Constructor<? extends Routable> constructor = rcHandler.getConstructor(ActiveSessions.class);
LOG.info("Bound legacy RC support");
LOG.finest("Bound legacy RC support");
Copy link
Member

Choose a reason for hiding this comment

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

This informational message is important to users. Please leave.

@@ -582,7 +582,7 @@ public void shouldPrioritizeHostsWithTheMostSlotsAvailableForASessionType() {
);

Session firefoxSession = distributor.newSession(createRequest(firefoxPayload)).getSession();
LOG.info(String.format("Firefox Session %d assigned to %s", i, chromeSession.getUri()));
LOG.finer(String.format("Firefox Session %d assigned to %s", i, chromeSession.getUri()));
Copy link
Member

Choose a reason for hiding this comment

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

Since this is in a test, I imagine that the choice of info level was deliberate.

@shs96c shs96c added the C-java label Nov 5, 2019
@yiming-tang-cs
Copy link
Contributor Author

Thank you for your in-depth feedback! We will discuss it and improve this PR!

@yiming-tang-cs
Copy link
Contributor Author

Hi, I cleaned up all the transformations that you disagreed with. We appreciate your valuable feedback!

@yiming-tang-cs
Copy link
Contributor Author

If there's anything we can do before merging the request, please let us know. Thanks!

@yiming-tang-cs
Copy link
Contributor Author

@shs96c Is there anything else we can do to merge the request?

@CLAassistant
Copy link

CLAassistant commented Nov 23, 2019

CLA assistant check
All committers have signed the CLA.

@yiming-tang-cs
Copy link
Contributor Author

The last two commits are only used to correct my email address to sign the CLA.

@yiming-tang-cs
Copy link
Contributor Author

yiming-tang-cs commented Nov 25, 2019

I also updated the branch (685f9a9) because the PR was showing that "This branch is out-of-date with the base branch".

@yiming-tang-cs
Copy link
Contributor Author

@shs96c Can we get it merged? Are there any other things we can do?

Copy link
Member

@shs96c shs96c left a comment

Choose a reason for hiding this comment

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

Thank you for nudging, and apologies for the delay getting this into the tree. Thank you!

@shs96c shs96c merged commit be6010c into SeleniumHQ:master Feb 15, 2020
@yiming-tang-cs
Copy link
Contributor Author

Thank you so much!!

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

Successfully merging this pull request may close these issues.

3 participants