[Freeswitch-dev] [POST-1.0.2][RFC][PATCH 0/2] Fine-grained logging: per-session logging

stkn at freeswitch.org stkn at freeswitch.org
Mon Dec 15 06:26:53 PST 2008


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.patch
  http://oss.axsentis.de/people/stkn/freeswitch/fs-r10758-session_loglevel-convert-mod_sofia.c.patch


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 at 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



More information about the Freeswitch-dev mailing list