2

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

ChumboChappati
  • 1,442
  • 4
  • 18
  • 38

1 Answers1

1

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.

Harald Wellmann
  • 12,615
  • 4
  • 41
  • 63
  • Thanks. What if I want WildFly to save the existing `server.log` file first with yyyy-MM-dd HH:mm:ss,SSS format and then do the work you mentioned? – ChumboChappati Sep 28 '15 at 18:24
  • You'd have to use a `periodic-size-rotating-file-handler`. `/subsystem=logging/periodic-size-rotating-file-handler=fh:add(append=false,autoflush=true,rotate-on-boot=true,suffix=".yyyy-MM-dd", named-formatter=PATTERN, max-backup-index=10, file={relative-to=jboss.server.log.dir, path=new-server.log})` – James R. Perkins Sep 29 '15 at 00:08