Skip to content

Commit

Permalink
adjust all log-levels besides WARN to TRACE
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
codecholeric committed Feb 2, 2023
1 parent 5e80b17 commit 69227cf
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void resolve(ImportedClasses classes) {
}

private void logConfiguration() {
log.debug("Automatically resolving transitive class dependencies with the following configuration:{}{}{}{}{}{}",
log.trace("Automatically resolving transitive class dependencies with the following configuration:{}{}{}{}{}{}",
formatConfigProperty(MAX_ITERATIONS_FOR_MEMBER_TYPES_PROPERTY_NAME, maxRunsForMemberTypes),
formatConfigProperty(MAX_ITERATIONS_FOR_ACCESSES_TO_TYPES_PROPERTY_NAME, maxRunsForAccessesToTypes),
formatConfigProperty(MAX_ITERATIONS_FOR_SUPERTYPES_PROPERTY_NAME, maxRunsForSupertypes),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static class Result implements Iterable<int[]> {
private boolean maxNumberOfCyclesReached = false;

private Result() {
log.debug("Maximum number of cycles to detect is set to {}; "
log.trace("Maximum number of cycles to detect is set to {}; "
+ "this limit can be adapted using the `archunit.properties` value `{}=xxx`",
configuration.getMaxNumberOfCyclesToDetect(), MAX_NUMBER_OF_CYCLES_TO_DETECT_PROPERTY_NAME);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private static class EventRecorder {
private final CycleConfiguration cycleConfiguration = new CycleConfiguration();

private EventRecorder() {
log.debug("Maximum number of dependencies to report per edge is set to {}; "
log.trace("Maximum number of dependencies to report per edge is set to {}; "
+ "this limit can be adapted using the `archunit.properties` value `{}=xxx`",
cycleConfiguration.getMaxNumberOfDependenciesToShowPerEdge(), MAX_NUMBER_OF_DEPENDENCIES_TO_SHOW_PER_EDGE_PROPERTY_NAME);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ private boolean refreezeViolations() {
}

private EvaluationResult storeViolationsAndReturnSuccess(EvaluationResultLineBreakAdapter result) {
log.debug("No results present for rule '{}'. Freezing rule result...", delegate.getDescription());
log.trace("No results present for rule '{}'. Freezing rule result...", delegate.getDescription());
store.save(delegate, result.getViolations());
return new EvaluationResult(delegate, result.getPriority());
}

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

private void removeObsoleteViolationsFromStore(CategorizedViolations categorizedViolations) {
List<String> solvedViolations = categorizedViolations.getStoredSolvedViolations();
log.debug("Removing {} obsolete violations from store: {}", solvedViolations.size(), solvedViolations);
log.trace("Removing {} obsolete violations from store: {}", solvedViolations.size(), solvedViolations);
if (!solvedViolations.isEmpty()) {
store.save(delegate, categorizedViolations.getStoredUnsolvedViolations());
}
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void initialize(Properties properties) {
storeFolder = new File(path);
ensureExistence(storeFolder);
File storedRulesFile = getStoredRulesFile();
log.info("Initializing {} at {}", TextFileBasedViolationStore.class.getSimpleName(), storedRulesFile.getAbsolutePath());
log.trace("Initializing {} at {}", TextFileBasedViolationStore.class.getSimpleName(), storedRulesFile.getAbsolutePath());
storedRules = new FileSyncedProperties(storedRulesFile);
checkInitialization(storedRules.initializationSuccessful(), "Cannot create rule store at %s", storedRulesFile.getAbsolutePath());
}
Expand Down Expand Up @@ -120,7 +120,7 @@ public boolean contains(ArchRule rule) {

@Override
public void save(ArchRule rule, List<String> violations) {
log.debug("Storing evaluated rule '{}' with {} violations: {}", rule.getDescription(), violations.size(), violations);
log.trace("Storing evaluated rule '{}' with {} violations: {}", rule.getDescription(), violations.size(), violations);
if (!storeUpdateAllowed) {
throw new StoreUpdateFailedException(String.format(
"Updating frozen violations is disabled (enable by configuration %s.%s=true)",
Expand Down Expand Up @@ -155,7 +155,7 @@ private String ensureRuleFileName(ArchRule rule) {
String ruleFileName;
if (storedRules.containsKey(rule.getDescription())) {
ruleFileName = storedRules.getProperty(rule.getDescription());
log.debug("Rule '{}' is already stored in file {}", rule.getDescription(), ruleFileName);
log.trace("Rule '{}' is already stored in file {}", rule.getDescription(), ruleFileName);
} else {
ruleFileName = createNewRuleId(rule).toString();
}
Expand All @@ -164,7 +164,7 @@ private String ensureRuleFileName(ArchRule rule) {

private UUID createNewRuleId(ArchRule rule) {
UUID ruleId = UUID.randomUUID();
log.debug("Assigning new ID {} to rule '{}'", ruleId, rule.getDescription());
log.trace("Assigning new ID {} to rule '{}'", ruleId, rule.getDescription());
storedRules.setProperty(rule.getDescription(), ruleId.toString());
return ruleId;
}
Expand All @@ -174,7 +174,7 @@ public List<String> getViolations(ArchRule rule) {
String ruleDetailsFileName = storedRules.getProperty(rule.getDescription());
checkArgument(ruleDetailsFileName != null, "No rule stored with description '%s'", rule.getDescription());
List<String> result = readLines(ruleDetailsFileName);
log.debug("Retrieved stored rule '{}' with {} violations: {}", rule.getDescription(), result.size(), result);
log.trace("Retrieved stored rule '{}' with {} violations: {}", rule.getDescription(), result.size(), result);
return result;
}

Expand Down

0 comments on commit 69227cf

Please sign in to comment.