Skip to content

Commit 69227cf

Browse files
committed
adjust all log-levels besides WARN to TRACE
Over the years there have been continuous issues by people not configuring their logging system appropriately and then being spammed by masses of DEBUG logs. In particular, because ArchUnit hooks into SLF4J and as it seems e.g. Spring Boot sets the log-level to DEBUG if the configuration is missing. While I principally think people should just correctly configure their logging infrastructure I've also been worn down over time ;-) So, I will reduce all non-WARN levels to TRACE now and accept that it will not be possible anymore to distinguish extremely spammy output (like "found access from x to y") from more central output (like "dependency resolution configuration") by log-level. Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
1 parent 5e80b17 commit 69227cf

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

archunit/src/main/java/com/tngtech/archunit/core/importer/DependencyResolutionProcess.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void resolve(ImportedClasses classes) {
124124
}
125125

126126
private void logConfiguration() {
127-
log.debug("Automatically resolving transitive class dependencies with the following configuration:{}{}{}{}{}{}",
127+
log.trace("Automatically resolving transitive class dependencies with the following configuration:{}{}{}{}{}{}",
128128
formatConfigProperty(MAX_ITERATIONS_FOR_MEMBER_TYPES_PROPERTY_NAME, maxRunsForMemberTypes),
129129
formatConfigProperty(MAX_ITERATIONS_FOR_ACCESSES_TO_TYPES_PROPERTY_NAME, maxRunsForAccessesToTypes),
130130
formatConfigProperty(MAX_ITERATIONS_FOR_SUPERTYPES_PROPERTY_NAME, maxRunsForSupertypes),

archunit/src/main/java/com/tngtech/archunit/library/dependencies/JohnsonCycleFinder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static class Result implements Iterable<int[]> {
119119
private boolean maxNumberOfCyclesReached = false;
120120

121121
private Result() {
122-
log.debug("Maximum number of cycles to detect is set to {}; "
122+
log.trace("Maximum number of cycles to detect is set to {}; "
123123
+ "this limit can be adapted using the `archunit.properties` value `{}=xxx`",
124124
configuration.getMaxNumberOfCyclesToDetect(), MAX_NUMBER_OF_CYCLES_TO_DETECT_PROPERTY_NAME);
125125
}

archunit/src/main/java/com/tngtech/archunit/library/dependencies/SliceCycleArchCondition.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ private static class EventRecorder {
174174
private final CycleConfiguration cycleConfiguration = new CycleConfiguration();
175175

176176
private EventRecorder() {
177-
log.debug("Maximum number of dependencies to report per edge is set to {}; "
177+
log.trace("Maximum number of dependencies to report per edge is set to {}; "
178178
+ "this limit can be adapted using the `archunit.properties` value `{}=xxx`",
179179
cycleConfiguration.getMaxNumberOfDependenciesToShowPerEdge(), MAX_NUMBER_OF_DEPENDENCIES_TO_SHOW_PER_EDGE_PROPERTY_NAME);
180180
}

archunit/src/main/java/com/tngtech/archunit/library/freeze/FreezingArchRule.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,13 @@ private boolean refreezeViolations() {
134134
}
135135

136136
private EvaluationResult storeViolationsAndReturnSuccess(EvaluationResultLineBreakAdapter result) {
137-
log.debug("No results present for rule '{}'. Freezing rule result...", delegate.getDescription());
137+
log.trace("No results present for rule '{}'. Freezing rule result...", delegate.getDescription());
138138
store.save(delegate, result.getViolations());
139139
return new EvaluationResult(delegate, result.getPriority());
140140
}
141141

142142
private EvaluationResult removeObsoleteViolationsFromStoreAndReturnNewViolations(EvaluationResultLineBreakAdapter result) {
143-
log.debug("Found frozen result for rule '{}'", delegate.getDescription());
143+
log.trace("Found frozen result for rule '{}'", delegate.getDescription());
144144
List<String> knownViolations = store.getViolations(delegate);
145145
CategorizedViolations categorizedViolations = new CategorizedViolations(matcher, result, knownViolations);
146146
removeObsoleteViolationsFromStore(categorizedViolations);
@@ -149,14 +149,14 @@ private EvaluationResult removeObsoleteViolationsFromStoreAndReturnNewViolations
149149

150150
private void removeObsoleteViolationsFromStore(CategorizedViolations categorizedViolations) {
151151
List<String> solvedViolations = categorizedViolations.getStoredSolvedViolations();
152-
log.debug("Removing {} obsolete violations from store: {}", solvedViolations.size(), solvedViolations);
152+
log.trace("Removing {} obsolete violations from store: {}", solvedViolations.size(), solvedViolations);
153153
if (!solvedViolations.isEmpty()) {
154154
store.save(delegate, categorizedViolations.getStoredUnsolvedViolations());
155155
}
156156
}
157157

158158
private EvaluationResult filterOutKnownViolations(EvaluationResultLineBreakAdapter result, Set<String> knownActualViolations) {
159-
log.debug("Filtering out known violations: {}", knownActualViolations);
159+
log.trace("Filtering out known violations: {}", knownActualViolations);
160160
return result.filterDescriptionsMatching(violation -> !knownActualViolations.contains(violation));
161161
}
162162

archunit/src/main/java/com/tngtech/archunit/library/freeze/ViolationStoreFactory.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public void initialize(Properties properties) {
8888
storeFolder = new File(path);
8989
ensureExistence(storeFolder);
9090
File storedRulesFile = getStoredRulesFile();
91-
log.info("Initializing {} at {}", TextFileBasedViolationStore.class.getSimpleName(), storedRulesFile.getAbsolutePath());
91+
log.trace("Initializing {} at {}", TextFileBasedViolationStore.class.getSimpleName(), storedRulesFile.getAbsolutePath());
9292
storedRules = new FileSyncedProperties(storedRulesFile);
9393
checkInitialization(storedRules.initializationSuccessful(), "Cannot create rule store at %s", storedRulesFile.getAbsolutePath());
9494
}
@@ -120,7 +120,7 @@ public boolean contains(ArchRule rule) {
120120

121121
@Override
122122
public void save(ArchRule rule, List<String> violations) {
123-
log.debug("Storing evaluated rule '{}' with {} violations: {}", rule.getDescription(), violations.size(), violations);
123+
log.trace("Storing evaluated rule '{}' with {} violations: {}", rule.getDescription(), violations.size(), violations);
124124
if (!storeUpdateAllowed) {
125125
throw new StoreUpdateFailedException(String.format(
126126
"Updating frozen violations is disabled (enable by configuration %s.%s=true)",
@@ -155,7 +155,7 @@ private String ensureRuleFileName(ArchRule rule) {
155155
String ruleFileName;
156156
if (storedRules.containsKey(rule.getDescription())) {
157157
ruleFileName = storedRules.getProperty(rule.getDescription());
158-
log.debug("Rule '{}' is already stored in file {}", rule.getDescription(), ruleFileName);
158+
log.trace("Rule '{}' is already stored in file {}", rule.getDescription(), ruleFileName);
159159
} else {
160160
ruleFileName = createNewRuleId(rule).toString();
161161
}
@@ -164,7 +164,7 @@ private String ensureRuleFileName(ArchRule rule) {
164164

165165
private UUID createNewRuleId(ArchRule rule) {
166166
UUID ruleId = UUID.randomUUID();
167-
log.debug("Assigning new ID {} to rule '{}'", ruleId, rule.getDescription());
167+
log.trace("Assigning new ID {} to rule '{}'", ruleId, rule.getDescription());
168168
storedRules.setProperty(rule.getDescription(), ruleId.toString());
169169
return ruleId;
170170
}
@@ -174,7 +174,7 @@ public List<String> getViolations(ArchRule rule) {
174174
String ruleDetailsFileName = storedRules.getProperty(rule.getDescription());
175175
checkArgument(ruleDetailsFileName != null, "No rule stored with description '%s'", rule.getDescription());
176176
List<String> result = readLines(ruleDetailsFileName);
177-
log.debug("Retrieved stored rule '{}' with {} violations: {}", rule.getDescription(), result.size(), result);
177+
log.trace("Retrieved stored rule '{}' with {} violations: {}", rule.getDescription(), result.size(), result);
178178
return result;
179179
}
180180

0 commit comments

Comments
 (0)