Author: ips
Date: 2009-10-27 15:42:06 -0400 (Tue, 27 Oct 2009)
New Revision: 818
Modified:
trunk/core/src/main/java/org/jboss/on/embedded/ui/SingleResourceAction.java
Log:
include faces messages in message that is logged when validation fails, but log the
message at DEBUG, rather than INFO
Modified: trunk/core/src/main/java/org/jboss/on/embedded/ui/SingleResourceAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/ui/SingleResourceAction.java 2009-10-23
19:34:16 UTC (rev 817)
+++ trunk/core/src/main/java/org/jboss/on/embedded/ui/SingleResourceAction.java 2009-10-27
19:42:06 UTC (rev 818)
@@ -19,6 +19,8 @@
*/
package org.jboss.on.embedded.ui;
+import java.util.List;
+
import javax.faces.application.FacesMessage;
import org.apache.commons.logging.Log;
@@ -138,10 +140,25 @@
}
}
- // TODO just a test
@Observer("org.jboss.seam.validationFailed")
public void validationFailed()
{
- log.info("validation failed");
+ FacesMessages messages = FacesMessages.instance();
+ List<FacesMessage> currentMessages = messages.getCurrentMessages();
+ StringBuilder buffer = new StringBuilder("[");
+ for (FacesMessage message : currentMessages) {
+ buffer.append(toString(message)).append(", ");
+ }
+ if (!currentMessages.isEmpty()) {
+ // chop off the last ", "
+ buffer.setLength(currentMessages.size() - 2);
+ }
+ buffer.append("]");
+ log.debug("Validation failed - FacesMessages: " + buffer);
}
+
+ private static String toString(FacesMessage message) {
+ return FacesMessage.class.getSimpleName() + "[(" +
message.getSeverity() + ") " + message.getSummary() + ": "
+ + message.getDetail() + "]";
+ }
}
Show replies by date