通过CLI将自定义记录器添加到JBoss EAP 6.2

时间:2014-09-15 12:23:05

标签: java java-ee jboss jboss7.x

我想有一个CLI命令,它将在standalone.xml中创建以下配置:

...
    <subsystem xmlns="urn:jboss:domain:logging:1.3">
     ...
        <custom-handler name="DB" class="com.jeefix.commons.logger.DatabaseHandler" module="com.jeefix">
            <level name="ALL"/>
            <formatter>
                <pattern-formatter pattern="%s%E%n"/>
            </formatter>
            <properties>
                <property name="jdbcUrl" value="${logger.database.url}"/>
                <property name="username" value="${logger.database.user}"/>
                <property name="password" value="${logger.database.password}"/>
                <property name="jdbcDriver" value="oracle.jdbc.driver.OracleDriver"/>
            </properties>
        </custom-handler>
    ...

我可以通过命令创建除属性列表之外的所有内容:

/subsystem=logging/custom-handler=DB:add(name=DB,class=com.jeefix.commons.logger.DatabaseHandler,module=com.jeefx.dbappender,formatter=%s%E%n,level=ALL)

问题:如何添加属性列表?

1 个答案:

答案 0 :(得分:5)

/subsystem=logging/custom-handler=server/:write-attribute(name=properties,value=[("jdbcUrl" => "your_jdbc_url"),("username" => "jdbc_user_name"),("password" => "jdbc_password"),("jdbcDriver" => "oracle.jdbc.driver.OracleDriver")])