Author: jim.ma
Date: 2009-11-09 03:13:48 -0500 (Mon, 09 Nov 2009)
New Revision: 11096
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/log4j.xml
stack/cxf/trunk/modules/testsuite/framework-tests/src/test/etc/log4j.xml
Log:
[JBWS-2824]:Fixed the log issue in cxf stack test suite and wsprovide tool
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderImpl.java
===================================================================
---
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderImpl.java 2009-11-06
09:27:18 UTC (rev 11095)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/tools/CXFProviderImpl.java 2009-11-09
08:13:48 UTC (rev 11096)
@@ -22,7 +22,6 @@
package org.jboss.wsf.stack.cxf.tools;
import java.io.File;
-import java.io.OutputStream;
import java.io.PrintStream;
import java.net.URL;
import java.net.URLClassLoader;
@@ -32,6 +31,7 @@
import org.apache.cxf.tools.java2ws.JavaToWS;
import org.jboss.ws.tools.io.NullPrintStream;
import org.jboss.wsf.spi.tools.WSContractProvider;
+import org.w3c.dom.Element;
/**
* A WSContractProvider for the CXF stack
@@ -92,6 +92,7 @@
{
try
{
+ initLog4j();
provide(loader.loadClass(endpointClass));
}
catch (ClassNotFoundException e)
@@ -148,7 +149,8 @@
PrintStream stream = messageStream;
if (stream != null)
{
- args.add("-verbose");
+ // There is no need to set verbose to cxf java2ws tool
+ //args.add("-verbose");
}
else
{
@@ -219,4 +221,32 @@
return cp;
}
+
+ /**
+ * cxf java2ws tool requires log4j configuration;this method will configure log4j when
running in command line and avoid the log4j not configure error.
+ */
+ private void initLog4j() {
+ //TODO: look at if it is possible to set jboss LoggerRepository
+ String xmlConfig = "<log4j:configuration
xmlns:log4j=\"http://jakarta.apache.org/log4j/\"
debug=\"false\">"
+ + "<appender name=\"CONSOLE\"
class=\"org.apache.log4j.ConsoleAppender\">"
+ + "<param name=\"Threshold\"
value=\"WARN\"/>"
+ + "<param name=\"Target\"
value=\"System.out\"/>"
+ + "<layout
class=\"org.apache.log4j.PatternLayout\">"
+ + " <param name=\"ConversionPattern\" value=\"%d
%-5p [%c] (%t) %m%n\"/>"
+ + "</layout>"
+ + "</appender>"
+ + "<root>"
+ + "<appender-ref ref=\"CONSOLE\"/>"
+ + "</root>"
+ + "</log4j:configuration>";
+ try
+ {
+ Element element =
javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new
java.io.StringBufferInputStream(xmlConfig)).getDocumentElement();
+ org.apache.log4j.xml.DOMConfigurator.configure(element);
+ }
+ catch (Exception e)
+ {
+ //igonre
+ }
+ }
}
Modified: stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/log4j.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/log4j.xml 2009-11-06 09:27:18
UTC (rev 11095)
+++ stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/etc/log4j.xml 2009-11-09 08:13:48
UTC (rev 11096)
@@ -57,10 +57,14 @@
<priority value="TRACE"/>
</category>
- <category name="org.apache.cxf">
- <priority value="TRACE"/>
+ <category name="org.apache.cxf.tools">
+ <priority value="WARN"/>
</category>
+ <category name="org.springframework">
+ <priority value="WARN"/>
+ </category>
+
<!-- Apache security is verbose -->
<category name="org.apache.xml.security">
<priority value="INFO"/>
@@ -72,7 +76,7 @@
<root>
<!--appender-ref ref="CONSOLE"/-->
- <appender-ref ref="FILE"/>
+ <appender-ref ref="CONSOLE"/>
</root>
</log4j:configuration>
Modified: stack/cxf/trunk/modules/testsuite/framework-tests/src/test/etc/log4j.xml
===================================================================
--- stack/cxf/trunk/modules/testsuite/framework-tests/src/test/etc/log4j.xml 2009-11-06
09:27:18 UTC (rev 11095)
+++ stack/cxf/trunk/modules/testsuite/framework-tests/src/test/etc/log4j.xml 2009-11-09
08:13:48 UTC (rev 11096)
@@ -57,10 +57,14 @@
<priority value="TRACE"/>
</category>
- <category name="org.apache.cxf">
- <priority value="TRACE"/>
+ <category name="org.apache.cxf.tools">
+ <priority value="WARN"/>
</category>
+ <category name="org.springframework">
+ <priority value="WARN"/>
+ </category>
+
<!-- Apache security is verbose -->
<category name="org.apache.xml.security">
<priority value="INFO"/>
@@ -72,7 +76,7 @@
<root>
<!--appender-ref ref="CONSOLE"/-->
- <appender-ref ref="FILE"/>
+ <appender-ref ref="CONSOLE"/>
</root>
</log4j:configuration>