我想有一个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)
问题:如何添加属性列表?
答案 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")])