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

Use ktlint's mechanism to initialize loggers #1414

Merged
merged 10 commits into from
Jun 30, 2022
Merged

Conversation

petertrr
Copy link
Member

@petertrr petertrr commented Jun 29, 2022

What's done:

  • Initialize loggers using kotlin-logging and extension from ktlint-core

This pull request closes #1413. Full description of the problem is in #1394

@petertrr petertrr added this to the 1.2.1 milestone Jun 29, 2022
@codecov
Copy link

codecov bot commented Jun 29, 2022

Codecov Report

Merging #1414 (5a2e21f) into master (1445b6e) will decrease coverage by 0.01%.
The diff coverage is 87.50%.

@@             Coverage Diff              @@
##             master    #1414      +/-   ##
============================================
- Coverage     83.39%   83.37%   -0.02%     
  Complexity     2557     2557              
============================================
  Files           106      107       +1     
  Lines          7598     7599       +1     
  Branches       2095     2095              
============================================
  Hits           6336     6336              
- Misses          373      374       +1     
  Partials        889      889              
Flag Coverage Δ
unittests 83.37% <87.50%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ktat/common/config/reader/ApplicationProperties.kt 0.00% <0.00%> (ø)
...at/ruleset/rules/chapter3/RangeConventionalRule.kt 75.47% <ø> (ø)
...tlin/org/cqfn/diktat/ruleset/utils/AstNodeUtils.kt 82.70% <ø> (-0.05%) ⬇️
...otlin/org/cqfn/diktat/common/utils/LoggingUtils.kt 50.00% <50.00%> (ø)
...t/common/config/reader/JsonResourceConfigReader.kt 41.66% <100.00%> (ø)
...fn/diktat/common/config/rules/RulesConfigReader.kt 32.20% <100.00%> (ø)
...kotlin/org/cqfn/diktat/ruleset/rules/DiktatRule.kt 66.66% <100.00%> (ø)
...cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt 97.50% <100.00%> (ø)
...qfn/diktat/ruleset/rules/chapter1/PackageNaming.kt 89.07% <100.00%> (ø)
...at/ruleset/rules/chapter2/comments/CommentsRule.kt 87.50% <100.00%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1445b6e...5a2e21f. Read the comment docs.

@petertrr petertrr marked this pull request as draft June 29, 2022 08:37
@github-actions
Copy link
Contributor

github-actions bot commented Jun 29, 2022

JUnit Tests (macOS, EnricoMi/publish-unit-test-result-action@v1)

1 278 tests   1 263 ✔️  12m 56s ⏱️
   159 suites       15 💤
   159 files           0

Results for commit 5a2e21f.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 29, 2022

JUnit Tests (Windows, EnricoMi/publish-unit-test-result-action@v1)

1 278 tests   1 263 ✔️  8m 53s ⏱️
   159 suites       15 💤
   159 files           0

Results for commit 5a2e21f.

♻️ This comment has been updated with latest results.

### What's done:
* Add dependencies
* Initialize loggers using kotlin-logging and extension from ktlint-core
@petertrr petertrr changed the title Add logback.xml to set logging level to INFO Use ktlint's mechanism to initialize loggers Jun 29, 2022
@petertrr petertrr marked this pull request as ready for review June 29, 2022 15:25
@petertrr petertrr requested review from nulls and orchestr7 June 29, 2022 15:25
@nulls
Copy link
Member

nulls commented Jun 30, 2022

this problem is relevant for gradle plugin (because we run ktlint as java -jar), but what's about maven plugin where we call ktlint directly?
Do we support different log level for maven plugin?

@petertrr
Copy link
Member Author

this problem is relevant for gradle plugin (because we run ktlint as java -jar), but what's about maven plugin where we call ktlint directly? Do we support different log level for maven plugin?

In maven plugin we don't depend on ktlint-cli and therefore don't depend on logback. Maven plugin should be using logger implementation provided by Maven, so there shouldn't be any problem.

### What's done:
* Added LoggingUtils.kt
@petertrr petertrr merged commit 43e6098 into master Jun 30, 2022
@petertrr petertrr deleted the bugfix/logback#1413 branch June 30, 2022 10:59
@nulls
Copy link
Member

nulls commented Jul 1, 2022

In maven plugin we don't depend on ktlint-cli and therefore don't depend on logback.

There aren't logging in ktlint\diktat code which is called by maven plugin, are there?

@petertrr
Copy link
Member Author

petertrr commented Jul 1, 2022

In maven plugin we don't depend on ktlint-cli and therefore don't depend on logback.

There aren't logging in ktlint\diktat code which is called by maven plugin, are there?

We are using a logger returned by AbstractMojo#getLog(), and it's slf4j-compatible AFIU

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.

Unexpected debug logs in 1.2.0
2 participants