rdf4j icon indicating copy to clipboard operation
rdf4j copied to clipboard

Repository "Configurations" class spams the log when using legacy config

Open aschwarte10 opened this issue 1 year ago • 3 comments

Current Behavior

The Configurations class is used to support both the new and legacy vocabulary for repository configurations.

The currrent implementation of org.eclipse.rdf4j.model.util.Configurations.logDiscrepancyWarning unfortunately spams the log on level WARN when using legacy config

Expected Behavior

My expectation would be that the method warns if the new and old property have diverging / contradicting values.

Currently it logs a warning even if there is only an old value (i.e. only the old vocabulary is used, and the new one is emptY).

I suggest to include a condition like

if (preferred.isEmpty()) {
  return;
}

As a workaround, we have set the logging level for the Configurations class to Error to avoid the log spam

Steps To Reproduce

Parse a repository configuration with legacy vocabulary

Example output

2024-06-25 07:56:18,777 WARN [main] org.eclipse.rdf4j.model.util.Configurations - Discrepancy between use of the old and new config vocabulary.
2024-06-25 07:56:18,778 WARN [main] org.eclipse.rdf4j.model.util.Configurations - Discrepancy between use of the old and new config vocabulary.
2024-06-25 07:56:18,778 WARN [main] org.eclipse.rdf4j.model.util.Configurations - Discrepancy between use of the old and new config vocabulary.
2024-06-25 07:56:18,778 WARN [main] org.eclipse.rdf4j.model.util.Configurations - Discrepancy between use of the old and new config vocabulary.
2024-06-25 07:56:18,778 WARN [main] org.eclipse.rdf4j.model.util.Configurations - Discrepancy between use of the old and new config vocabulary.
2024-06-25 07:56:18,782 WARN [main] org.eclipse.rdf4j.model.util.Configurations - Discrepancy between use of the old and new config vocabulary.
2024-06-25 07:56:18,783 WARN [main] org.eclipse.rdf4j.model.util.Configurations - Discrepancy between use of the old and new config vocabulary.
2024-06-25 07:56:18,783 WARN [main] org.eclipse.rdf4j.model.util.Configurations - Discrepancy between use of the old and new config vocabulary.
2024-06-25 07:56:18,783 WARN [main] org.eclipse.rdf4j.model.util.Configurations - Discrepancy between use of the old and new config vocabulary.

Version

5.0.0

Are you interested in contributing a solution yourself?

None

Anything else?

Note that this is a minor issue only

aschwarte10 avatar Jun 25 '24 06:06 aschwarte10

The model vocabulary should automatically be updated to the new vocabulary and written back to disk. So these error messages should only happen once, the first time the model is parsed before it is upgraded?

The logging also isn't very useful when it doesn't log any info that would help to diagnose the issue.

We could use debug log level for when the difference is that the preferred is empty. Warn for when both preferred and legacy have values but they are different.

We should also fix: public static Set<Value> getPropertyValues(Model model, Resource subject, IRI property, IRI legacyProperty) {

We have tests in ConfigurationsTest that actually check logging, so those would need to be updated.

hmottestad avatar Jun 25 '24 09:06 hmottestad

@aschwarte10 Do you want to fix this yourself?

hmottestad avatar Jun 25 '24 09:06 hmottestad

@aschwarte10 Do you want to fix this yourself?

I can do, but would be able only in about two weeks (if that is sufficient). We are currently in release finalization phase which takes all my attention.

I like the suggestion to distinguish the log level based on preferredValue being empty.

Note that in our case it is spammy as we load repository configurations from file during our application startup, i.e. updating them is an explicit migration

aschwarte10 avatar Jun 26 '24 06:06 aschwarte10