Sure, could you prepare a PR?

I also added a section about new constants available since Struts 6.x
https://cwiki.apache.org/confluence/display/WW/Struts+2.5+to+6.0.0+migration#Struts2.5to6.0.0migration-Newconstants


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

niedz., 2 sty 2022 o 11:07 Greg Huber <gregh3...@gmail.com> napisał(a):
>
> 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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org
For additional commands, e-mail: dev-h...@struts.apache.org

Reply via email to