How to set the max size of the Wildfly server log

10,567

Solution 1

For (1) I'm not sure - is this OS installed? I don't have that file but I just extract the tarball.

For (2) and (3) I think it's a case of looking in domain/configuration/domain.xml or standalone/configuration/standalone.xml for the appropriate ("default"?) periodic-rotating-file-handler and adding, say:

<rotate-size value="20k"/> <!-- Limit on size of file -->
<max-backup-index value="1"/> <!-- Number of log files to keep -->

Solution 2

  1. create size-rotating-file-handler

        <size-rotating-file-handler name="FILE_SIZE">
            <level name="DEBUG"/>
            <file relative-to="jboss.server.log.dir" path="server.log"/>
            <rotate-size value="1m"/> <!-- the size, could be 100k, 10m etc-->
            <max-backup-index value="5"/> <!-- backup index, default is 1, please set it to a large number -->
            <append value="true"/>
        </size-rotating-file-handler>
    
  2. use the handler created

        <root-logger>
            <level name="INFO"/>
            <handlers>
                <handler name="CONSOLE"/>
                <handler name="FILE"/>
                <handler name="FILE_SIZE"/> <!-- this is what you need to add -->
            </handlers>
        </root-logger>
    
Share:
10,567
iso_9001_
Author by

iso_9001_

An AI enthusiast and GM of idayapayzeka

Updated on July 12, 2022

Comments

  • iso_9001_
    iso_9001_ almost 2 years

    We have Wildfly running on Domain mode in our production system. There are around 10 web servers and there is only on log file for all 10 servers. The log file is located under /var/log/wildfly/wildfly.log file. The last time I checked, the files was around 5 GB. My problems are:

    1. Is there any way to separate the server logs so that each server has its own log file?
    2. Is there any way to set the log file to max size limit to prevent over-growing?
    3. Is there any way to delete the log file and start over? Logs before 2 days is useless for me so most of the data in the log file is redundant.

    Regard