OpenSER Logging

Logging is crucial to discover what happens with the SIP server internally. A lot of messages are printed directly from source code, but what is more important is the ability of adding new log messages in the configuration file. This gives a very helpful hand to debug SIP message processing and configuration file.

By default, OpenSER writes the log messages to syslog. It can be configured to print to terminal via stderr instead, option good to use during troubleshooting sessions.

Core logging


OpenSER core provides the function log() which can print a static message. Here is an example of usage:


#
# logging example
#

# ------------------ module loading ----------------------------------

fork=no
log_stderror=yes
debug=3


# -------------------------  request routing logic -------------------

# main routing logic

route{
	if (uri==myself) {
		log(1, "SIP request to my domain\n");
	} else {
		log(1, "SIP request to foreign domain\n");
	};
}



xlog logging


xlog module provides the functions xlog() and xdbg() which can print dynamic message (message may differ from case to case). Here is an example of usage:


#
# logging example
#

# ------------------ module loading ----------------------------------

fork=no
log_stderror=yes
debug=3

mpath="/usr.local/lib/openser/modules"

loadmodule "xlog.so"

# -------------------------  request routing logic -------------------

# main routing logic

route{
	if (uri==myself) {
		xlog("L_ERR", "SIP request [$rm] to my domain [$rd]\n");
	} else {
		xlog("L_ERR", "SIP request [$rm] to foreign domain [$rd]\n");
	};
}


At runtime, $rm is replaced by request type (e.g., INVITE, REGISTER, ...) and $rd by request R-URI domain (e.g., openser.org) (see pseudo-variables list).

See aslo

Logging is crucial to discover what happens with the SIP server internally. A lot of messages are printed directly from source code, but what is more important is the ability of adding new log messages in the configuration file. This gives a very helpful hand to debug SIP message processing and configuration file.

By default, OpenSER writes the log messages to syslog. It can be configured to print to terminal via stderr instead, option good to use during troubleshooting sessions.

Core logging


OpenSER core provides the function log() which can print a static message. Here is an example of usage:


#
# logging example
#

# ------------------ module loading ----------------------------------

fork=no
log_stderror=yes
debug=3


# -------------------------  request routing logic -------------------

# main routing logic

route{
	if (uri==myself) {
		log(1, "SIP request to my domain\n");
	} else {
		log(1, "SIP request to foreign domain\n");
	};
}



xlog logging


xlog module provides the functions xlog() and xdbg() which can print dynamic message (message may differ from case to case). Here is an example of usage:


#
# logging example
#

# ------------------ module loading ----------------------------------

fork=no
log_stderror=yes
debug=3

mpath="/usr.local/lib/openser/modules"

loadmodule "xlog.so"

# -------------------------  request routing logic -------------------

# main routing logic

route{
	if (uri==myself) {
		xlog("L_ERR", "SIP request [$rm] to my domain [$rd]\n");
	} else {
		xlog("L_ERR", "SIP request [$rm] to foreign domain [$rd]\n");
	};
}


At runtime, $rm is replaced by request type (e.g., INVITE, REGISTER, ...) and $rd by request R-URI domain (e.g., openser.org) (see pseudo-variables list).

See aslo

Created by: openser, Last modification: Mon 08 of Jan, 2007 (22:57 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+