简体   繁体   中英

How to create a new server.log every time WildFly start?

I am working with WildFly 8.2.1.Final (Standalone mode). All the messages are logged in server.log file in standalone\\log directory.

When I start WildFly currently it logs messages by appending them in server.log file.

What I want when I start WildFly, is WildFly create a new server.log file and then log messages in it. How can I do that?

Thanks

Simply set append to false in the file handler element of your logging subsystem in standalone.xml :

    <subsystem xmlns="urn:jboss:domain:logging:3.0">
        <periodic-rotating-file-handler name="FILE" autoflush="true">
            <formatter>
                <named-formatter name="PATTERN"/>
            </formatter>
            <file relative-to="jboss.server.log.dir" path="server.log"/>
            <suffix value=".yyyy-MM-dd"/>
            <append value="false"/>
        </periodic-rotating-file-handler>
      </subsystem>

You can also replace the default periodic-rotating-file-handler by a plain file-handler .

Check out the XML schemas in $JBOSS_HOME/docs/schema for the exact syntax.

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