Commits

musachy  committed d152dd2

WW-3067 Add a configuration constant to turn on/off the logging of missing properties by OGNL

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@1953e221344d-f017-0410-9bd5-d282ab1896d7

  • Participants
  • Parent commits 4443aa5

Comments (0)

Files changed (3)

File src/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java

         builder.factory(PropertyAccessor.class, CompoundRoot.class.getName(), CompoundRootAccessor.class, Scope.SINGLETON);
         builder.factory(OgnlUtil.class, Scope.SINGLETON);
         builder.constant("devMode", "false");
+        builder.constant("logMissingProperties", "false");
         return builder.create(true);
     }
 

File src/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java

                .factory(OgnlUtil.class, Scope.SINGLETON)
                .factory(XWorkBasicConverter.class, Scope.SINGLETON);
         props.setProperty("devMode", Boolean.FALSE.toString());
+        props.setProperty("logMissingProperties", Boolean.FALSE.toString());
     }
 
 }

File src/java/com/opensymphony/xwork2/ognl/OgnlValueStack.java

 
     private static Logger LOG = LoggerFactory.getLogger(OgnlValueStack.class);
     private boolean devMode;
+    private boolean logMissingProperties;
 
     public static void link(Map<String, Object> context, Class clazz, String name) {
         context.put("__link", new Object[]{clazz, name});
         devMode = "true".equalsIgnoreCase(mode);
     }
 
+    @Inject("logMissingProperties")
+    public void setLogMissingProperties(String logMissingProperties) {
+        this.logMissingProperties = "true".equalsIgnoreCase(logMissingProperties);
+    }
+
     /* (non-Javadoc)
      * @see com.opensymphony.xwork2.util.ValueStack#getContext()
      */
                 }
             }
             if (!availableProperties.contains(expr)) {
-                if (devMode) {
+                if (devMode && logMissingProperties) {
                     LOG.warn("Could not find property [" + expr + "]");
                 }