LogStrategy extends AbstractTagStrategy { public void execute(final VoiceXmlInterpreterContext context, final VoiceXmlInterpreter interpreter, final FormInterpretationAlgorithm fia, final FormItem item, final VoiceXmlNode node) throws JVoiceXMLEvent { final NodeList list = node.getChildNodes(); final StringBuilder outputText = new StringBuilder(); final String label = (String) getAttribute(Log.ATTRIBUTE_LABEL); if (label != null) { outputText.append(label); outputText.append(": "); } final String expr = (String) getAttribute(Log.ATTRIBUTE_EXPR); if (expr != null) { outputText.append(expr); } final DataModel model = context.getDataModel(); for (int i = 0; i < list.getLength(); i++) { final VoiceXmlNode current = (VoiceXmlNode) list.item(i); if (current instanceof Text) { final Text text = (Text) current; final String msg = text.getNodeValue(); if (msg == null) { LOGGER.warn("ignoring empty log node"); } else { outputText.append(msg.trim()); } } if (current instanceof Value) { final Value value = (Value) current; String currentExpr = value.getExpr(); if (currentExpr != null) { final String unescapedCurrentExpr = StringEscapeUtils .unescapeXml(currentExpr); if (!currentExpr.endsWith(";")) { currentExpr += ";"; } final Object eval = model.evaluateExpression( unescapedCurrentExpr, Object.class); final String evalReadable = model.toString(eval); outputText.append(evalReadable); } } } if (outputText.length() > 0) { LOGGER.info(outputText.toString()); } } LogStrategy(); Collection<String> getEvalAttributes(); void execute(final VoiceXmlInterpreterContext context,
            final VoiceXmlInterpreter interpreter,
            final FormInterpretationAlgorithm fia, final FormItem item,
            final VoiceXmlNode node);  }
@Test public void testExecute() throws Exception, JVoiceXMLEvent { final Block block = createBlock(); final Log log = block.appendChild(Log.class); final String message = TestAppender.TEST_PREFIX + "this is a simple log test"; log.addText(message); LogStrategy strategy = new LogStrategy(); executeTagStrategy(log, strategy); Assert.assertTrue("message not found in appender", TestAppender.containsMessage(message)); }