Thanks for the new struts.i18n.search.defaultbundles.first=true to speed
up the system :-).
It works great, although when in default mode (false) there is now
probably too much logging.
AbstractLocalizedTextProvider
protected String getMessage(String bundleName, Locale locale, String
key, ValueStack valueStack, Object[] args) {
ResourceBundle bundle = findResourceBundle(bundleName, locale);
if (bundle == null) {
return null;
}
if (valueStack != null) {
reloadBundles(valueStack.getContext());
}
try {
String message = bundle.getString(key);
if (valueStack != null) {
message =
TextParseUtil.translateVariables(bundle.getString(key), valueStack);
}
MessageFormat mf = buildMessageFormat(message, locale);
return formatWithNullDetection(mf, args);
} catch (MissingResourceException e) {
*if (devMode) {**
** LOG.warn("#2Missing key [{}] in bundle [{}]!", key,
bundleName);**
** } else {**
** LOG.debug("Missing key [{}] in bundle [{}]!", key,
bundleName);**
** }*
return null;
}
}
If it matches a bundle for the class (EventAdd.properties) and does not
find the property it logs,
2022-01-02 09:55:32,786 WARN
com.opensymphony.xwork2.util.AbstractLocalizedTextProvider
AbstractLocalizedTextProvider:getMessage - #2Missing key [eventadd.tip]
in bundle [*my.EventAdd*]!
For an invalid property:
2022-01-02 09:55:32,786 WARN
com.opensymphony.xwork2.util.AbstractLocalizedTextProvider
AbstractLocalizedTextProvider:getMessage - #2Missing key [eventadd.tipz]
in bundle [*my.EventAdd*]!
and then logs it again as not found:
2022-01-02 09:55:32,796 WARN
com.opensymphony.xwork2.util.AbstractLocalizedTextProvider
AbstractLocalizedTextProvider:findDefaultText - Missing key
[eventadd.tipz] in bundles [[ApplicationResources,
org/apache/struts2/struts-messages,
com/opensymphony/xwork2/xwork-messages]]!
2022-01-02 09:55:32,797 WARN org.apache.struts2.util.TextProviderHelper
TextProviderHelper:getText - The first TextProvider in the ValueStack
(*my.EventAd**d*) could not locate the message resource with key
'eventadd.tipz'
2022-01-02 09:55:32,797 WARN org.apache.struts2.util.TextProviderHelper
TextProviderHelper:getText - The default value expression
'eventadd.tipz' was evaluated and did not match a property. The literal
value 'eventadd.tipz' will be used.
We could comment out the MissingResourceException logging, reducing the
unnecessary entries, and if it really does not exist we get the full log.
Cheers Greg