• Examples (iOS)
• Examples (Java/Android)
• Examples (C++)
Server API Documentation

 

» 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:

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:

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:

PatternDescription
'.' yyyy-MM Roll over monthly.
'.' yyyy-MM-dd Roll over at midnight each day.
'.' yyyy-MM-dd-aRoll 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-mmRoll over every minute.
'.' yyyy-wwRoll over on the first day of each week depending upon the locale.

Then save the changes and restart SFS2X.