Skip to content

Always write log messages in English - #7202

Open
stweil wants to merge 2 commits into
kitodo:mainfrom
stweil:log-messages-in-english
Open

Always write log messages in English#7202
stweil wants to merge 2 commits into
kitodo:mainfrom
stweil:log-messages-in-english

Conversation

@stweil

@stweil stweil commented Aug 23, 2026

Copy link
Copy Markdown
Member

Some log messages were hardcoded in German, or resolved through the message resource bundle in the user's UI language. This led to a mix of languages in the log file, which complicates monitoring. As discussed in #6846, all log messages are now written in English.

  • Replace five German log messages in LdapServerService with English
  • Replace Helper.getTranslation(ERROR_EXPORT, ...) log calls in ExportDms with a static English message
  • Replace non-ASCII characters in log messages (FilterService, ImageManagement)

Assisted-by: OpenCode / qwen3.8-27b-thinking (Alibaba Cloud)

Some log messages were hardcoded in German, or resolved through the
message resource bundle in the user's UI language. This led to a mix
of languages in the log file, which complicates monitoring. As
discussed in kitodo#6846, all log messages are now
written in English.

- Replace five German log messages in LdapServerService with English
- Replace Helper.getTranslation(ERROR_EXPORT, ...) log calls in
  ExportDms with a static English message
- Replace non-ASCII characters in log messages (FilterService,
  ImageManagement)

Assisted-by: OpenCode / qwen3.8-27b-thinking (Alibaba Cloud)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
@codacy-production

codacy-production Bot commented Aug 23, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@stweil

stweil commented Aug 23, 2026

Copy link
Copy Markdown
Member Author

AI generated summary:

A. Exception messages built from translated text (47 sites)

The exception message is resolved through the message resource bundle in the user's UI language (de/en/es). Whenever such an exception is logged — stack trace, getMessage(), getLocalizedMessage() — localized text ends up in the log file. Since the text is part of the exception, this cannot be fixed at the log call site.

Kitodo/src/main/java/org/kitodo/production/converter/BeanConverter.java

  • L76: new ConverterExceptionerrorConvert → Incorrect type: '{0}' must be '{1}'!

Kitodo/src/main/java/org/kitodo/production/forms/IndexingForm.java

  • L100: new IllegalStateException — dynamic key (ObjectType.getTranslationSingular()) → “<translated object type name> is no class for indexing”

Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java

  • L1335: new IllegalArgumentExceptiondataEditor.dragNDropLinkError → Structure elements and media cannot be moved between different processes!
  • L1346: new IllegalArgumentExceptiondataEditor.dragNDropError → Unable to move element of type "{0}" to element of type "{1}"!
  • L1469: new IllegalArgumentExceptiondataEditor.dragNDropError → Unable to move element of type "{0}" to element of type "{1}"!
  • L1473: new IllegalArgumentExceptiondataEditor.dragNDropError → Unable to move element of type "{0}" to element of type "{1}"!
  • L1661: new IllegalArgumentExceptiondataEditor.childNotContainedError → Parents of structure {0} do not contain structure!
  • L1665: new IllegalArgumentExceptiondataEditor.noParentsError → No parents of structure {0} found!
  • L1669: new IllegalArgumentExceptiondataEditor.forbiddenChildElement → Structure of type {0} is not allowed as child of {1}!
  • L1685: new IllegalArgumentExceptiondataEditor.noParentsError → No parents of structure {0} found!
  • L1692: new IllegalArgumentExceptiondataEditor.childNotContainedError → Parents of structure {0} do not contain structure!
  • L1697: new IllegalArgumentExceptiondataEditor.forbiddenChildElement → Structure of type {0} is not allowed as child of {1}!

Kitodo/src/main/java/org/kitodo/production/helper/TempProcess.java

  • L230: new ProcessGenerationExceptionnewProcess.docTypeMetadataMissing → Unable to import metadata. No metadata for document type classification ("use='docType'") found in ruleset "{0}"!

Kitodo/src/main/java/org/kitodo/production/interfaces/activemq/CreateNewProcessesProcessor.java

  • L180: new ProcessorExceptionprocessTitleAlreadyInUse → The process title '{0}' is already in use.

Kitodo/src/main/java/org/kitodo/production/process/Generator.java

  • L62: new ProcessGenerationExceptionerrorDataIncomplete + errorVolume → Incomplete data: | Volume number is not a valid number.

Kitodo/src/main/java/org/kitodo/production/process/TiffHeaderGenerator.java

  • L120: new ProcessGenerationExceptionerrorReading + configurationOPAC → Error while reading from '{0}'. | OPAC configuration

Kitodo/src/main/java/org/kitodo/production/services/command/EditDataScript.java

  • L163: new KitodoScriptExecutionExceptionkitodoScript.noStructureOfTypeFound → No structure element with type "{0}" found

Kitodo/src/main/java/org/kitodo/production/services/data/ImportService.java

  • L857: new ProcessGenerationExceptionimportError.wrongNumberOfEadParentLevelElements → EAD XML does not contain exactly one element of parent level "{0}"!
  • L1001: new ProcessGenerationExceptionimportError.emptyDocument → Unable to create process from imported XML document.
  • L1506: new ConfigExceptionmassImport.recordIdentifierDefinitionMissing → At least one metadata in ruleset '{0}' must be configured as 'recordIdentifier'
  • L1519: new ConfigExceptionmassImport.recordIdentifierMissing → No record identifier found in given metadata!
  • L1630: new ProcessGenerationExceptionmassImport.invalidDocumentType → Invalid document type: '{0}'
  • L1680: new ProcessGenerationExceptionprocessTitleEmpty → No process title stated.
  • L1682: new ProcessGenerationExceptionprocessTitleInvalid → Invalid title for process. It should match '{0}' regular expression.
  • L1684: new ProcessGenerationExceptionprocessTitleAlreadyInUse → The process title '{0}' is already in use.

Kitodo/src/main/java/org/kitodo/production/services/data/MassImportService.java

  • L120: new KitodoCsvImportExceptionmassImport.separatorCountMismatchEntries → Entries in given CSV file do not contain the same number of columns line when parsed with separator character '{0}'.
  • L150: new RuntimeExceptionmassImport.csvCellMismatch → Number of CSV cells does not match number of skip indices!
  • L175: new RuntimeExceptionmassImport.metadataKeysMismatch → Number of metadata keys does not match number of skip indices!
  • L195: new RuntimeExceptionmassImport.csvCellMismatch → Number of CSV cells does not match number of skip indices!

Kitodo/src/main/java/org/kitodo/production/services/data/TemplateService.java

  • L278: new ProcessGenerationExceptionnoStepsInWorkflow → No steps of the workflow defined.
  • L282: new ProcessGenerationExceptionnoUserInStep → No user assigned to step {0}.

Kitodo/src/main/java/org/kitodo/production/services/data/WorkflowService.java

  • L152: new DAOExceptionduplicateWorkflowTitle → Workflow with title "{0}" already exists.

Kitodo/src/main/java/org/kitodo/production/services/file/FileService.java

  • L148: new CommandExceptionfileNotFound → File not found: {0}.
  • L736: new IOExceptionmetadataFileNotFound → Metadata file not found : {0}
  • L753: new IOExceptionmetadataFileNotFound → Metadata file not found : {0}

Kitodo/src/main/java/org/kitodo/production/services/validation/FileStructureValidationService.java

  • L102: new FileStructureValidationExceptionvalidation.rulesetValidationErrorTitle → Error validating ruleset "{0}" against ruleset schema definition "ruleset.xsd"
  • L161: new FileStructureValidationExceptionvalidation.mappingFileValidationError → Error validating mapping file "{0}" against XSLT schema definition "xslt20.xsd"
  • L209: new FileStructureValidationExceptionvalidation.internalDataRecordValidationError → Error validating internal data record against Kitodo and METS schema definitions
  • L212: new FileStructureValidationExceptionvalidation.internalDataRecordAndMappingFilesValidationError → Error validating internal data record created by transforming external record using mapping file(s) [ {0} ] against Kitodo and METS schema definitions
  • L237: new FileStructureValidationExceptionvalidation.externalDataRecordValidationError → Error validating external data record with ID "{0}" as valid "{1}" against schema definition(s) [ {2} ]

Kitodo/src/main/java/org/kitodo/production/workflow/model/Converter.java

  • L146: new WorkflowExceptionworkflowExceptionRoleNotFound → Roles assigned to workflow task '{0}' do not exists.
  • L151: new WorkflowExceptionworkflowExceptionMissingRoleAssignment → No roles assigned to the workflow task '{0}'.

Kitodo/src/main/java/org/kitodo/production/workflow/model/Reader.java

  • L159: new WorkflowExceptionworkflowExceptionParallelGatewayOneTask → Parallel gateway is followed by one task!
  • L164: new WorkflowExceptionworkflowExceptionParallelGatewayNoTask → Parallel gateway is not followed by any tasks!
  • L181: new WorkflowExceptionworkflowExceptionParallelBranch → Task in parallel branch cannot have second task. Please remove task after task '{0}'.
  • L225: new WorkflowExceptionworkflowExceptionMissingGateway → Task '{0}' has more than one following tasks without any gateway in between!
  • L244: new WorkflowExceptionworkflowExceptionLoop → Task '{0}' has more than one incoming elements - probably workflow contains not allowed loop.

B. Log statements logging e.getLocalizedMessage() (18 sites)

Secondary: for most exceptions getLocalizedMessage() == getMessage(). The locale dependence comes from the exception message itself (section A). Listing them here for completeness/consistency (candidates for switching to getMessage() or a static English log message).

  • Kitodo/src/main/java/org/kitodo/production/forms/createprocess/CreateProcessForm.java:385logger.error(e.getLocalizedMessage(), e)
  • Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessDateMetadata.java:59logger.error(e.getLocalizedMessage(), e)
  • Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessFieldedMetadata.java:222logger.error(e.getLocalizedMessage())
  • Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessFieldedMetadata.java:491logger.info(e.getLocalizedMessage(), e)
  • Kitodo/src/main/java/org/kitodo/production/forms/createprocess/ProcessMetadata.java:115logger.error(e.getLocalizedMessage())
  • Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/DataEditorForm.java:924logger.info(e.getLocalizedMessage(), e)
  • Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/StructurePanel.java:1358logger.error(exception.getLocalizedMessage(), exception)
  • Kitodo/src/main/java/org/kitodo/production/forms/massimport/MassImportForm.java:278logger.info(ee.getLocalizedMessage())
  • Kitodo/src/main/java/org/kitodo/production/forms/massimport/MassImportForm.java:308logger.error(ex.getLocalizedMessage())
  • Kitodo/src/main/java/org/kitodo/production/helper/tasks/EmptyTask.java:425logger.error(exception.getLocalizedMessage(), exception)
  • Kitodo/src/main/java/org/kitodo/production/model/bibliography/course/IndividualIssue.java:261logger.error(e.getLocalizedMessage())
  • Kitodo/src/main/java/org/kitodo/production/security/CustomLoginSuccessHandler.java:64logger.error(e.getLocalizedMessage())
  • Kitodo/src/main/java/org/kitodo/production/security/DynamicAuthenticationProvider.java:109logger.debug(problem.getLocalizedMessage(), problem)
  • Kitodo/src/main/java/org/kitodo/production/services/data/ImportService.java:247logger.error(e.getLocalizedMessage())
  • Kitodo/src/main/java/org/kitodo/production/services/data/ImportService.java:648logger.error(e.getLocalizedMessage())
  • Kitodo/src/main/java/org/kitodo/production/services/data/ImportService.java:1398logger.error(e.getLocalizedMessage())
  • Kitodo/src/main/java/org/kitodo/production/services/data/LdapServerService.java:148logger.error(e.getLocalizedMessage(), e)
  • Kitodo-Query-URL-Import/src/main/java/org/kitodo/queryurlimport/QueryURLImport.java:147logger.error(e.getLocalizedMessage())

C. Direct non-English / translated log messages (already fixed in this branch)

  • LdapServerService.java:205,210,212,214,430 — five German log strings → English
  • ExportDms.java:167,310logger.error(Helper.getTranslation(ERROR_EXPORT, ...), e) → static English literal
  • FilterService.java:317 — non-ASCII ´ → ASCII quotes
  • ImageManagement.java:160 — typographic apostrophe → ASCII

Method / coverage notes

  • Scanned all 477 log4j/log4j2/SLF4J log statements in *.java (all modules, logger variables uniformly named logger), plus all new *Exception/*Error constructions.
  • Excluded: FacesMessage validation messages (UI-only, never logged), third-party library logging (out of our control, mostly English), user-entered data (titles, comments) which may be in any language by nature.
  • Related, separate issue: ~100 Helper.setErrorMessage(key, params, logger, e) calls log the raw message key (e.g. errorSaving) instead of a readable message.

if (Objects.nonNull(exportDmsTask)) {
exportDmsTask.setException(e);
logger.error(Helper.getTranslation(ERROR_EXPORT, process.getTitle()), e);
logger.error("Export canceled for process: '{}'", process.getTitle(), e);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please use the message key as before and statically translate it to English instead of hardcoding the translation into the Java code.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done now.

if (Objects.nonNull(exportDmsTask)) {
exportDmsTask.setException(e);
logger.error(Helper.getTranslation(ERROR_EXPORT, process.getTitle()), e);
logger.error("Export canceled for process: '{}'", process.getTitle(), e);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

See above.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done now.

Per review: instead of hardcoding the English translation into the
Java code, keep the message key (errorExport) and resolve it through
the message resource bundle, but pinned to English so the log file
stays in English regardless of the user's UI language.

Add a Helper.getTranslation(Locale, ...) overload that resolves the
key in a given language; the existing overload now delegates to it
using the user's UI language.

Assisted-by: OpenCode / qwen3.8-27b-thinking (Alibaba Cloud)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
@stweil

stweil commented Aug 26, 2026

Copy link
Copy Markdown
Member Author

The CI is still flaky and fails often until PR #7185 was merged.

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