I like alternate version because it does not limit the scope of the special logging to sessions. It can then be used to aggregate logging on any common filterable item. On Mon, Dec 15, 2008 at 8:26 AM, <stkn@freeswitch.org> wrote:
Hi,
the following series of patches adds a per-session logging capability (patch 1) and converts a part of mod_sofia over to use the new functions as an example (patch 2).
Note: This is one of two possible ways to implement the feature... (see below)
Why?: Some of "us" are running fs with high call volumes and turning on debugging globally causes massive amounts of space used and reduced performance. This patch extends the logging api to be able to change the log level for e.g. a single session (either from the dialplan or via API command / C API) for diagnosing problems.
How?: The core patch adds a couple of new functions:
switch_core_session_log_printf(switch_core_session_t *, ...) switch_core_session_set_loglevel() switch_core_session_get_loglevel()
A new API command "uuid_loglevel <uuid> <level>" (mod_commands.c) and a dialplan app "session_loglevel" (mod_dptools.c part of the core patch) are included.
The default loglevel of a session is the current global log level.
All instances of switch_log_printf() that log session-specific messages need to be converted to the new log function for this to be useful! (The second patch has the changes for mod_sofia.c)
Alternative implementation:
There's a second way to implement this feature, without adding another log_printf function:
switch_log_printf has a "userdata" parameter that is currently unused, which could be used to pass an additional value (e.g. a session) by adding additional SWITCH_*_LOG helper macros. A session log call could look like this:
switch_log_printf(SWITCH_SESSION_LOG(session), SWITCH_LOG_DEBUG, "I'm a session debug message\n");
Pro: - Can be extended for other type of log actions (e.g. if we want to implement even more fine-grained logging, per-module etc.) without adding more switch_*_log_printf functions
Con: - More work for switch_log_printf()
Now it's up to you to discuss which way we want to go and if this feature is deemed useful :P
Stefan
P.S.: The patches are available via http too:
http://oss.axsentis.de/people/stkn/freeswitch/fs-r10758-session_loglevel.pat...
http://oss.axsentis.de/people/stkn/freeswitch/fs-r10758-session_loglevel-con...
Diffstat of the core patch:
include/private/switch_core_pvt.h | 1 include/switch_core.h | 15 ++++++++++ include/switch_log.h | 18 +++++++++++++ mod/applications/mod_commands/mod_commands.c | 37 +++++++++++++++++++++++++++ mod/applications/mod_dptools/mod_dptools.c | 19 +++++++++++++ switch_core_session.c | 15 ++++++++++ switch_log.c | 34 ++++++++++++++++++++---- 7 files changed, 133 insertions(+), 6 deletions(-)
-- Stefan Knoblich Systemadministrator
axsentis GmbH Eupener Strasse 74 50933 Köln
Tel: 0180 - 506 705 521* Fax: 0180 - 506 705 529*
E-Mail: s.knoblich@axsentis.de Web: www.axsentis.de
Eingetragen beim AG Köln: HR B 56238 UST-ID: DE244977565 Gesellschafter-Geschäftsführer: Yan Lecomte, Eduard Schlein, Apostolos Varsamis
*14ct/min aus dem Festnetz der T-Com | dtms
_______________________________________________ Freeswitch-dev mailing list Freeswitch-dev@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400