Hi,

OpenSER trunk has a new logging design, covering new functionalities (for end-user), more simplicity (for developers), better log format, etc.

End-user functionalities
=========================

1) configurable debug level at runtime - so far we had static debug level, but now, there is a MI function to change it at runtime. If you want to have or not a configurable debug level, there is a compile option named CHANGEABLE_DEBUG_LEVEL (see Makefile.defs). By default is on, but, if there are performance concerns, you can turn it off.
The MI function is called "debug":
 # display the current debug level
 openserctl fifo debug
 # set a new debug level (L_ERR)
 openserctl fifo debug -1

The function changes the global debug level, so all processes and all code will be affected.

2) script function for changing the debug level - this functions allows you to change the debug level from script, only for a specific script block. Only the debug level of the current process will be changed. This is very helpful if you are tracing and debugging only a specific piece of code.
The script function is:
   setdebug(4); # set debug level for debug
   setdebug(); # reset the debug level to the global one

Ex:
   debug= -1 # err only
   .....
   {
      ......
      setdebug(4);
      uac_replace_from(....);
      setdebug();
      .......
   }
The function change the debug level of the current process and changing the global debug level (MI function) does not affect it, so be careful and reset the pre process debug level when you are done.



More simplicity
=================

The logging function used in code was replaced with a new set of functions, more simple and flexible:
   LOG / DBG were replaced with:
   LM_ALERT( ...)
   LM_CRIT( ...)
   LM_ERR( ...)
   LM_WARN( ...)
   LM_NOTICE( ...)
   LM_INFO( ...)
   LM_DBG( ...)

Prototype is LM_XXX( "FMT", .....);
The functions will automatically add to the logged message the log level, the module name, function name, process pid and time stamp, so you do not have to care about it from the code.



Better log format
==================

Even if you use syslog or stderr logging, the log message will contain information about log level, the module name, function name, process pid and time stamp.

For syslog, the log level is mapped over the syslog levels, so no text will be used - you can configure syslog to use different files for each log level. Also time and pid are not pushed from openser as this info is automatically logged by syslog.

For stderr logging, openser take care and appends the log level as text, time and pid (as text).

Ex:
   Jul 23 19:52:19 [0] INFO:sl:mod_init: Initializing StateLess engine

So, either you are using syslog, either stderr, you will still get the same information logged.


We still need to migrate all the log messages from script from the old to the new set of functions, so, for the moment, not all logs will be "nice" formatted.


Regards,
Bogdan



_______________________________________________
Users mailing list
Users@openser.org
http://openser.org/cgi-bin/mailman/listinfo/users

Reply via email to