FreeSWITCH uses a modular logging system made up of three independent output modules:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/signalwire/freeswitch/llms.txt
Use this file to discover all available pages before exploring further.
mod_console for terminal output, mod_logfile for persistent log files, and mod_syslog for integration with the system logging daemon. Each module is configured independently, and all three can be active simultaneously. Every log message carries a severity level, an originating source file or function name, and an optional session UUID — making it straightforward to filter and correlate events from a specific call.
Log Levels
FreeSWITCH uses eight named severity levels. Each level has a numeric value; lower numbers indicate higher severity. When you set a log level, you receive messages at that level and all higher-severity levels.| Level | Name | Numeric | Meaning |
|---|---|---|---|
| CONSOLE | console | 1 | Messages displayed only in the interactive console (not written to files). |
| ALERT | alert | 2 | Conditions that require immediate human intervention. |
| CRIT | crit | 3 | Critical failures — the switch may not be functioning correctly. |
| ERR | err | 4 | Error conditions that affect a feature or call, but not the whole switch. |
| WARNING | warning | 5 | Potentially harmful situations worth monitoring. |
| NOTICE | notice | 6 | Normal but significant events such as registrations and call setups. |
| INFO | info | 7 | General informational messages about switch operation. |
| DEBUG | debug | 8 | Verbose developer-level output; not recommended for production. |
Console Logging (mod_console)
mod_console writes log output directly to the terminal when FreeSWITCH is running in interactive console mode (-c) or foreground mode (-nf). It supports colorized output and per-source log filtering through a <mappings> section.
Configuration is in conf/autoload_configs/console.conf.xml:
Per-Source Filtering
The<mappings> section lets you reduce noise by showing only high-severity messages globally while enabling full verbosity for a specific source file or function. The name attribute accepts:
all— matches every log source (overrides other entries if present)- A filename such as
mod_sofia.c— matches messages from that source file - A function name such as
switch_core_state_machine— matches messages from that function
File Logging (mod_logfile)
mod_logfile writes log output to one or more persistent log files. It supports automatic rotation by file size and a configurable maximum number of retained rotated files. Configuration is in conf/autoload_configs/logfile.conf.xml:
Multiple Log Profiles
You can define additional<profile> blocks to write different subsets of log data to different files. For example, write only errors to a separate error log:
Syslog (mod_syslog)
mod_syslog forwards FreeSWITCH log messages to the host operating system’s syslog daemon (rsyslog, syslog-ng, journald, etc.), enabling centralized log aggregation and standard log-rotation tooling. Configuration is in conf/autoload_configs/syslog.conf.xml:
loglevel parameter uses the same severity names as other logging modules (debug, info, notice, warning, err, crit, alert). Setting it to warning is a sensible default for syslog — it captures actionable events without flooding the system log.
Setting Log Level at Runtime
You can change the console log verbosity while FreeSWITCH is running without editing any configuration files or restarting. Changes take effect immediately and persist until the next restart.0 suppresses all console output.
Log Rotation
mod_logfile automatically rotates the active log file when it reaches the size configured in rollover. You can also trigger an immediate rotation without restarting the switch.
Triggering Rotation Manually
Triggering Rotation via the Console
rotate-on-hup is true in logfile.conf.xml, a SIGHUP signal causes the current log file to be renamed with a timestamp (or a numeric suffix if maximum-rotate is set) and a new log file to be opened. This is compatible with external rotation tools such as logrotate using the postrotate directive.
Example logrotate Configuration
Debugging Calls
When troubleshooting a specific call or SIP negotiation failure, several runtime commands expose additional detail without requiring a log level change across the entire system.SIP Message Tracing
Sofia Log Level
Thesofia loglevel command adjusts the verbosity of the Sofia-SIP stack’s internal logging independently of the FreeSWITCH log level. Level 9 is the most verbose.
default, tport, iptsec, nea, nta, nth_client, nth_server, nua, soa, sresolv, and stun.
Per-Call Debugging
For a targeted view of a single session, you can filter log output by UUID in themod_logfile profile (using the uuid option) and then grep the log file: