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

JENKINS-55194 Add logLevel to support debugging and also reduce default excessive logging #12

Merged
merged 3 commits into from
Jan 2, 2019

Conversation

nrayapati
Copy link
Member

Description

JENKINS-55194 Add logLevel to support debugging and also reduce default excessive logging

See JENKINS-55194.

@nrayapati nrayapati self-assigned this Jan 2, 2019
@nrayapati nrayapati requested review from ghenkes and wwftw January 2, 2019 00:27
@nrayapati
Copy link
Member Author

Test results: Masked IP address.

  • Invalid logLevel: TEST

    bad log level
  • Default logLevel: SEVERE appendName: false - Non passive change, probably should we set the defaults to make this passive???

    default log level
  • logLevel: INFO, appendName: true

    info log level and appendname


|logLevel
|String
a|Defaults to *SEVERE*
Copy link

Choose a reason for hiding this comment

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

Is the a supposed to be at the start of this line?

Copy link
Member Author

Choose a reason for hiding this comment

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

That is actually asciidoc syntax to support asciidoc content in column (list in this case)

https://asciidoctor.org/docs/user-manual/#cols-format

Look for the string below to find the table

The column styles are described in the table below.

Copy link

Choose a reason for hiding this comment

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

nice. I wondered if it might be related to the list.

if(remote.appendName) {
interaction = {
when(line: _, from: standardOutput) {
logger.println("$remote.name|$it")
Copy link

Choose a reason for hiding this comment

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

can we do something like this instead so we don't repeat as much?

Suggested change
logger.println("$remote.name|$it")
def logPrefix = remote.appendName ? "$remote.name|" : ''
interaction = {
when(line: _, from: standardOutput) {
logger.println("$logPrefix$it")
}
when(line: _, from: standardError) {
logger.println("$logPrefix$it")
}
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, let me update it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated with ce8bccb and also tested by deploying change on a local Jenkins again.

@nrayapati
Copy link
Member Author

Thank you @ghenkes for a quick review. :)

try {
Level.parse(remote.logLevel)
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException(getPrefix() + "Bad log level $remote.logLevel for $remote.name")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add the original exception here?

Suggested change
throw new IllegalArgumentException(getPrefix() + "Bad log level $remote.logLevel for $remote.name")
throw new IllegalArgumentException(getPrefix() + "Bad log level $remote.logLevel for $remote.name", e)

Copy link
Member Author

Choose a reason for hiding this comment

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

As it was IllegalArgumentException itself, I don't think adding e would add much value.

@@ -38,6 +40,9 @@ class Common {
validateUserAuthentication(remote)
validateHostAuthentication(remote)
validateProxyConnection(remote)
if(remote.logLevel) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: add space between if (

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch, let me update it quickly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated with b74eb7b

if(remote.logLevel) {
rootLogger.setLevel(Level.parse(remote.logLevel))
} else {
rootLogger.setLevel(Level.SEVERE)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there much noise in org.hidetake to pick a default log level this high?

Copy link
Member Author

Choose a reason for hiding this comment

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

Intention was to turn off the logging by default and leave it to the consumer to increase it based on the needs.

@nrayapati nrayapati merged commit 169e8f8 into master Jan 2, 2019
@nrayapati nrayapati deleted the JENKINS-55194 branch January 2, 2019 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants