1 Reply Latest reply on May 10, 2016 6:58 PM by jamezp

    How to generate server.log in custom folder location in wildfly-8.2.0.Final

    sridharthiyagarajan

      Hello,

       

      I am facing a problem regarding server.log file generation in Wildfly-8.2.0.Final AS.

       

      Below is the size-rotating-file-handler definition used in logging subsystem <subsystem xmlns="urn:jboss:domain:logging:2.0"> of standalone-full-ha.xml.

       

       

          <size-rotating-file-handler name="FILE" autoflush="false">

                <level name="DEBUG"/>

                <file relative-to="jboss.server.log.dir" path="server.log"/>

                <rotate-size value="500k"/>

                <max-backup-index value="5"/>

                <append value="true"/>

          </size-rotating-file-handler>

       

      The above works fine and it generates server.log in ${WILDFLY_HOME}/standalone/log folder. I would like to have a custom location for server.log and hence, modified the path attribute to contain the complete custom path and removed relative-to attribute as shown below.

       

          <file path="D:/wildfly-8.2.0.Final/standalone/log/server.log"/>

       

      But, with the above changes, server.log is getting generated in custom location but facing the below problems:

       

      - log statements are getting generated without date in it. for e.g.:

       

      12:16:11,800 INFO  [org.jboss.as] (MSC service thread 1-7) JBAS015899: WildFly 8.2.0.Final "Tweek" starting

        

      - Complete logs are not observed in the log file and for example, "server is started..." will be the last line and a quarter of the log statements are not printed.

       

      Please help me.

        • 1. Re: How to generate server.log in custom folder location in wildfly-8.2.0.Final
          jamezp

          Try setting autoflush to true. It's likely just being buffered and not written. As for the date not being printed you'll need to use a formatter to get date. Assuming the default configuration there should be a patter-formatter called PATTERN which will log the full timestamp.

          /subsystem=logging/size-rotating-file-handler=FILE:write-attribute(name=named-formatter, value=PATTERN)
          

           

          Also note you can override the jboss.server.log.dir by setting the system property in the JAVA_OPTS. Or you can configure a custom path and use that in the relative-to.

          /path=my.log.dir:add(path="/var/log/")
          

           

          --

          James R. Perkins