SFS2X Docs / GettingStarted / log-configuration
» Configuring the logging system
SFS2X provides detailed logs of the server activities and runtime errors that are stored under the {SFS2X}/logs/ folder. In particular:
- logs/ contains the main server logs
- logs/boot/ contains specifc messages related to the server's startup phase; if SFS2X fails to start you should check what went wrong in this folder
- logs/http/ contains the logs relative to the embedded web server and the BlueBox tunneling system
The logs are also inspectable via the AdminTool's Log Viewer module.
» Configuring Logging Levels
There are three main logging levels that you can set as default to increase or decrese 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 for production otherwise it could impact the server performance and generate huge log files.
- INFO: is the default level, provides essential informations on users connecting/disconnecting, room creations and removal. This is good for production and if you need details about the overall user's activity.
- ERROR: provides minimal logging, limited to runtime errors.
In order to change the logging level you can edit the {SFS2X}/config/log4j.properties and change this line (should be line 61):
log4j.category.com.smartfoxserver=INFO,consoleAppender,fileAppender
Substitute INFO with DEBUG or ERROR. Then save the file and restart SFS2X.
» Configuring the log file rolling
Log files can be rolled at specific intervals (hourly, daily, weekly...) to avoid having one big single file. To change this behavior open {SFS2X}/config/log4j.properties with your favorite text editor and locate this line:
log4j.appender.fileAppender.DatePattern='.'yyyy-MM-dd
You can use several different patterns such as:
Pattern | Description |
---|---|
'.' yyyy-MM | Roll over monthly. |
'.' yyyy-MM-dd | Roll over at midnight each day. |
'.' yyyy-MM-dd-a | Roll over at midday and midnight of each day. |
'.' yyyy-MM-dd-HH | Roll over at the top of every hour (DEFAULT) |
'.' yyyy-MM-dd-HH-mm | Roll over every minute. |
'.' yyyy-ww | Roll over on the first day of each week depending upon the locale. |
Then save the changes and restart SFS2X.