Skip to content

Conversation

@javier-garcia-sonarsource
Copy link

@javier-garcia-sonarsource javier-garcia-sonarsource commented Dec 10, 2024

@sonarqube-next
Copy link

sonarqube-next bot commented Dec 10, 2024

@javier-garcia-sonarsource javier-garcia-sonarsource marked this pull request as ready for review December 10, 2024 12:36
Copy link
Member

@henryju henryju left a comment

Choose a reason for hiding this comment

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

Have you manually tested the change? I don't see how this would prevent to log a stacktrace.
What we usually do (for example in the Scanner Engine) is to create a special type of exception (see MessageException). This exception will be caught at the higher possible level, and then log will be:

  • only log the exception message in INFO
  • if the debug level is enabled, log message + stacktrace

@javier-garcia-sonarsource
Copy link
Author

Have you manually tested the change? I don't see how this would prevent to log a stacktrace. What we usually do (for example in the Scanner Engine) is to create a special type of exception (see MessageException). This exception will be caught at the higher possible level, and then log will be:

  • only log the exception message in INFO
  • if the debug level is enabled, log message + stacktrace

Hi @henryju , do you mean this? https://github.com/SonarSource/sonar-scanner-engine/blob/master/sonarcloud/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerMain.java#L76

@henryju
Copy link
Member

henryju commented Dec 10, 2024

Have you manually tested the change? I don't see how this would prevent to log a stacktrace. What we usually do (for example in the Scanner Engine) is to create a special type of exception (see MessageException). This exception will be caught at the higher possible level, and then log will be:

  • only log the exception message in INFO
  • if the debug level is enabled, log message + stacktrace

Hi @henryju , do you mean this? https://github.com/SonarSource/sonar-scanner-engine/blob/master/sonarcloud/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerMain.java#L76

yes, that is what I was referring to. I would suggest to take inspiration from that.

@javier-garcia-sonarsource
Copy link
Author

Closing this PR because the changes needed to fix this issue are more complex than expected. I will add my findings on the ticket description

@javier-garcia-sonarsource javier-garcia-sonarsource deleted the improvement/javier/SCANJLIB-169/omit_stack_traces_connection_errors branch December 10, 2024 15:22
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.

2 participants