Configuring the log files
SmartFoxServer 3 provides detailed logs of the server activity and errors that are stored under the server/logs/ folder. In particular:
- logs/ contains the main server logs
- logs/http/ contains the logs relative to the embedded Tomcat server that provides different web services (BlueBox tunneling system, WebSocket, upload management etc.)
The logs are also inspectable via the AdminTool > Log Viewer module.
Configuring Logging Levels
There are three main logging levels that you can set as default to increase or decrease the amount of information reported in the log files:
-
DEBUG: provides lots of details about each incoming/outgoing request including a binary dump of each packet. This level is recommended only for local debugging, it must be turned off in production to avoid performance degradation
-
INFO: is the default level, provides essential information on users connecting/disconnecting, room creations and removal. This is good for production and if you need details about the overall user's activity
-
WARN: provides reduced logging volume, limited to runtime errors.
To modify the logging level you can edit the server/config/logback.xml and search for this line:
then modify the level, save and restart SmartFoxServer
Configuring the log file rolling policy
Log files can be rolled at specific intervals to avoid generating a single log file. To modify the rolling policy open server/config/logback.xml and locate this section:
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>logs/smartfox.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- keep X days worth of history capped at Y MBs total size -->
<maxHistory>30</maxHistory>
<totalSizeCap>100MB</totalSizeCap>
</rollingPolicy>
Here you can customize the interval at which log files are logged, the total size of the archived logs, the maximum number of archived files etc. For a detailed breakdown of the available settings please check the Logback TimeBasedRollingPolicy docs.