需要帮助在 JBoss 7.1.1 的standalone.xml 中设置 Log4j JDBCAppender
我已经尝试如下但不工作
<subsystem xmlns="urn:jboss:domain:logging:1.1">
....
....
....
<custom-handler name="DB" class="org.apache.log4j.jdbc.JDBCAppender" module="org.apache.log4j">
<level name="ERROR"/>
<properties>
<property name="URL">Data Base URL</property>
<property name="driver">edb-jdbc14</property>
<property name="user">username</property>
<property name="password">password</property>
</properties>
<formatter>
<pattern-formatter pattern="INSERT INTO log_dtl(application_type,thread,class,method,line_no,level,log_date,message_key,message_dtl,message_desc,message_meta_data) VALUES('APP','%t','%c','%M','%L','%p','%d{dd/MM/yyyy HH:mm:ss}','%X{MESSAGE_KEY}','%m','%X{MESSAGE_DESC}','%X{MESSAGE_META_DATA}')" />
</formatter>
<drivers>
<driver name="edb-jdbc14" module="com.edb-jdbc14.postgresDriver">
<driver-class>com.edb.Driver</driver-class>
</driver>
</drivers>
</custom-handler>
....
....
</subsystem>
错误日志
14:56:16,881 ERROR [org.jboss.as.server] JBAS015956: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: JBAS014676: Failed to parse configuration
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:141) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.ServerService.boot(ServerService.java:266) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:155) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_02]
Caused by: java.lang.IllegalArgumentException: newValue is null
at org.jboss.dmr.ModelNode.set(ModelNode.java:458) [jboss-dmr-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.logging.LoggingSubsystemParser.parsePropertyElement(LoggingSubsystemParser.java:898)
at org.jboss.as.logging.LoggingSubsystemParser.parseCustomHandlerElement(LoggingSubsystemParser.java:610)
at org.jboss.as.logging.LoggingSubsystemParser.readElement(LoggingSubsystemParser.java:169)
at org.jboss.as.logging.LoggingSubsystemParser.readElement(LoggingSubsystemParser.java:113)
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.server.parsing.StandaloneXml.parseServerProfile(StandaloneXml.java:894) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.parsing.StandaloneXml.readServerElement_1_1(StandaloneXml.java:330) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:127) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:100) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:133) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
... 3 more
此错误是 DB 驱动程序加载问题,但如何解决此问题,或任何其他设置此错误的方法