简体   繁体   中英

JBoss standalone.xml file changes are being overridden

We am using JBoss 7 in our project and have written the logging configuration in standalone.xml file like this,

 <subsystem xmlns="urn:jboss:domain:logging:1.0">
        .
        .
        .
        <logger category="com.xyz.abc.aspect">
            <level name="DEBUG"/> 
            <handlers>
                <handler name="FILE"/>
            </handlers>
        </logger>
        .
        .
    </subsystem>

Now a situation has arose that i wanted to change the logging configuration by adding use-parent-handlers="false" to avoid the log being redirected to parent handler, now when i add this to standalone.xml

 <logger category="com.xyz.abc.aspect" use-parent-handlers="false">
                <level name="DEBUG"/> 
                <handlers>
                    <handler name="FILE"/>
                </handlers>
            </logger>

and restart the server the logging configuration is reverted back by JBoss to the previous state ie

<logger category="com.xyz.abc.aspect">
                <level name="DEBUG"/> 
                <handlers>
                    <handler name="FILE"/>
                </handlers>
            </logger>

I have tried deleting standalone_xml_history directory and files under it, but nothing is preventing the overwriting behaviour, can any one please suggest.

I'm not 100% sure, but restarting the server probably causes a write-back action of the config. That means your config gets overwritten by with the "current" config the server knows which is the version before you edited the file. You could simply use the management console

confguration > core > logging
or use the CLI
/subsystem=logging/logger=change.me.please:write-attribute(name="use-parent-handlers", value="false")
to make those changes.

Alternatively change the config file when the server is stopped.

You need to update standalone.initial.xml in standalone_xml_history directory. Then restart Jboss, your changes would take place.

reference- https://docs.jboss.org/author/display/AS7/Configuration%20file%20history.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM