[MAGNOLIA-5891] Reduce amount of duplicate i18n keys warnings in the log Created: 18/Aug/14  Updated: 22/Sep/14  Resolved: 17/Sep/14

Status: Closed
Project: Magnolia
Component/s: i18n
Affects Version/s: 5.2.7, 5.3.2
Fix Version/s: 5.3.4

Type: Bug Priority: Neutral
Reporter: Richard Gange Assignee: Christoph Meier
Resolution: Fixed Votes: 0
Labels: support
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

There are a lot (hundreds) of duplicate key warnings being thrown at startup. There also seems to be a big difference between the number of warnings thrown by the bundle vs a webapp built using the maven archetype. Specifically, the issue is much more widespread when using the a webapp built using maven archetype.

We should probably double check that we are checking for duplicates correctly. If so, then we have a lot of duplicate keys that need to fixed in many modules. I would assume that we need to open tickets for each module suffering the issue.



 Comments   
Comment by Christoph Meier [ 21/Aug/14 ]

Probably this one is related to http://jira.magnolia-cms.com/browse/MGNLCTS-62 (but, to be honest, i'm not 100% sure; so, remove the link if it's not true).
It might be helpfull to compare the modules used in "bundle" vs "webapp"; then look for wrong usage of SimpleTranslator / TranslationServiceImpl. (wrong usage=instantiating instead of injecting).

However, it looks like there are definitely duplicate keys; it is just possible that they are logged "too often" (in some cases).

Comment by Christoph Meier [ 12/Sep/14 ]

The above comment seems to be wrong. Ticket is not related to MGNLCTS-62. So i remove the "related to link".

I also cannot confirm that custom bundles (created with maven archetype) have more of these "Found duplicate key"-log-entries (Fdk-l-e).
I've tested some bundles (EE and CE): 5.2.8, 5.2.7, 5.3.2. It seems, all these bundles typyically have 10 or 11 Fdk-l-e's per instance.
Custom created bundle (with added magnolia-enterprise-webapp) have also the same numbers of Fdk-l-e's per instance on startup.
The only bundles where i observe reproducible high amounts of Fdk-l-e's:

  • CE 5.3.3-SNAPSHOT; started by IDE (intelliJ) => 1040 Fdk-l-e's per instance
  • EE 5.3.3-SNAPSHOT; started by IDE (intelliJ) => 1226 Fdk-l-e's per instance

(To see all numbers, check evernote-sheet)
The good news: Only one instance of TranslationServiceImpl and thus DefaultMessageBundlesLoader is created.

Some more numbers (for CE; the numbers in EE are a little bit higher)

  • 251 properties-files are loaded; everytime, one is loaded, complete double-entries-check runs
  • we properties-files for 8 locales - but not all locales have the same amount of translated keys

=> Actually, the only important thing to mention here: The huge amount of log files only appear when starting the bundle from the IDE. <=

Comment by Christoph Meier [ 15/Sep/14 ]

Commit is on branch MAGNOLIA-5891 (see https://git.magnolia-cms.com/gitweb/?p=magnolia_main.git;a=commit;h=0ca4f8b8e8c8ab0737c0af999db5d28331392f3f )

Comment by Christoph Meier [ 15/Sep/14 ]

I've changed log pattern.
The DefaultMessageBundlesLoader will log a summary of the duplicates and show the URLs of the files which were responsible for the duplicates.
To see all the duplicates, log-level DEBUG is required.
=> The number of log-entries due to duplicates has decreased - even when running from IDE.

Comment by Christopher Zimmermann [ 17/Sep/14 ]
  • Please improve following three messages as discussed:
    ALL duplicates: 11
    Duplicates per key and local: 11
    Duplicates per key: 4
  • Please rename:
    idWithLocale > keyWithLocale
    idWIthLocaleAndUrl > keyWithLocaleAndUrl
  • Please print to log (Maybe info log? or debug log) a brief tip that IDEA developer environment can cause issuees with overlays etc.
  • Please replace typo's 'local' with 'locale'.
  • Can you improve this comment? I dont understand it: "(duplicates from duplicated jars or overlays are not taken into account)"
  • "// some inner class to monitor the duplicates" > "// An inner class to monitor the duplicates"
Comment by Christoph Meier [ 17/Sep/14 ]

Fixed / changed according to review comments. (See https://git.magnolia-cms.com/gitweb/?p=magnolia_main.git;a=commit;h=f411f66ef9f0408bcd724ad2e5178b8693f3046c)

Generated at Mon Feb 12 04:09:22 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.