You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2013/10/16 00:22:10 UTC

svn commit: r1532566 - /myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java

Author: lu4242
Date: Tue Oct 15 22:22:09 2013
New Revision: 1532566

URL: http://svn.apache.org/r1532566
Log:
MYFACES-3788 Improve log message in RendererUtils.getClientId with component location

Modified:
    myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java

Modified: myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java?rev=1532566&r1=1532565&r2=1532566&view=diff
==============================================================================
--- myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java (original)
+++ myfaces/core/trunk/shared/src/main/java/org/apache/myfaces/shared/renderkit/RendererUtils.java Tue Oct 15 22:22:09 2013
@@ -1265,17 +1265,32 @@ public final class RendererUtils
         {
             final char separatorChar = UINamingContainer
                     .getSeparatorChar(facesContext);
-            if (log.isLoggable(Level.INFO))
-            {
-                log.info("Unable to find component '"
-                        + forAttr
-                        + "' (calling findComponent on component '"
-                        + uiComponent.getClientId(facesContext)
-                        + "')."
-                        + " We'll try to return a guessed client-id anyways -"
-                        + " this will be a problem if you put the referenced component"
-                        + " into a different naming-container. If this is the case, " 
-                        + "you can always use the full client-id.");
+            
+            Level level = Level.WARNING;
+            boolean productionStage = facesContext.isProjectStage(ProjectStage.Production);
+            if (productionStage)
+            {
+                level = Level.FINE;
+            }
+            if (log.isLoggable(level))
+            {
+                StringBuilder sb = new StringBuilder();
+                sb.append("Unable to find component '");
+                sb.append(forAttr);
+                sb.append("' (calling findComponent on component '");
+                sb.append(uiComponent.getClientId(facesContext));
+                sb.append("'");
+                if (!productionStage)
+                {
+                    sb.append(", viewLocation: ");
+                    sb.append(uiComponent.getAttributes().get(UIComponent.VIEW_LOCATION_KEY));
+                }
+                sb.append(").");
+                sb.append(" We'll try to return a guessed client-id anyways -");
+                sb.append(" this will be a problem if you put the referenced component");
+                sb.append(" into a different naming-container. If this is the case, ");
+                sb.append("you can always use the full client-id.");
+                log.info(sb.toString());
             }
             if (forAttr.length() > 0 && forAttr.charAt(0) == separatorChar)
             {