Jump to ID:
Multimedia

Project Home

Documents

Discussions

Wiki

Project Info
Forum Topic - Tip #1: Getting logs from MM applications: (3 Items)
   
 
 
Tip #1: Getting logs from MM applications  
Hi Everyone,

We'll be posting tips in this forum on a frequent basis to keep discussion going as well provide useful tips to 
customers.  Feel free to ask any questions in these forums.

Today's tip is how to get logs from MM applications.

MME provides two ways to turn on logs.  

The first is to pass '-v' to the mme process when you start it.  If you pass one '-v' then the MME is at verbosity level
 1.  If you three ('-vvv') then it runs at verbosity level 3 and will log more content.   Keep in mind the more that you
 log the slower the system gets, but the more information you have to work with to debug.

The second way is to tell the MME at runtime what verbosity to run at and you can do this using the command line 
application mmecli:   "mmecli set_debug 4 0".  That would turn on verbosity level 4.

If you want to dump mme logs only from slogger you can do that with sloginfo:
sloginfo -m 27  # dump only major code 27 which is MME.


io-media can be configured to have different debug levels at startup.  You can do this similar to how you start the MME 
except that you use '-D' instead of '-v'.  The more '-D's you use the higher the debug verbosity.

If you want to dump the io-media logs only, you can do it with this command:
sloginfo -m 20  # dump only major code 20 which is io-media


QDB offers a few debug capabilities:

Runtime error reporting:  This prints any critical errors while interacting with the system (not queries).  This is 
enabled by passing in '-v' on the command line.  I recommend while debugging your system to run with 6 -v's:  "-vvvvvv".


Runtime tracing:  If tracing is enabled it will log all SQL queries that are passed into QDB from clients as soon as the
 query starts to execute.  It will log the SQL query, the client, and the database.   You can enable this by using "-o 
trace" on the command line.

Runtime profiling:  If profiling is enabled it will log all SQL queries that are passed into QDB from clients as soon as
 the query completes execution.   It will log the client, the database, the query string, and the time it took to 
execute (world time, not CPU time).  You can enable this by using "-o profile" on the command line to QDB.

Since tracing and profiling run through slogger, you can get timestamps for when exactly the command executed.  With 
sloginfo usually it will print second accuracy, if you want millisecond accuracy then pass sloginfo the '-t' option.

If you want to dump all slog'd QDB logs (including tracing and profiling) with millisecond accuracy then you can use 
this command:
sloginfo -t -m 26 # major code for QDB is 26
Re: Tip #1: Getting logs from MM applications  
Dan Cardamore wrote:
> io-media can be configured to have different debug levels at startup.
> You can do this similar to how you start the MME except that you
> use '-D' instead of '-v'.  The more '-D's you use the higher the debug
verbosity.

It might be worth adding that these debug levels are based on slogger's 
severity levels.  By default, io-media logs messages with severity 
levels of _SLOG_INFO and higher, and _SLOG_DEBUG1 and _SLOG_DEBUG2 
messages are not even sent to slogger (to speed up normal processing). 
A single -D enables _SLOG_DEBUG1, and a second -D turns on _SLOG_DEBUG2; 
since that's the lowest severity known to slogger, a third -D does nothing.

There also is the -q option ("quiet") that does the opposite: suppresses 
the lower-severity messages.  A single -q will switch off _SLOG_INFO, 
two of them will disable _SLOG_NOTICE as well, and so on.  If you mix 
some -q's with some -D's they'll cancel each other out.


For the more advanced users, it has recently become possible to change 
this verbosity level dynamically, without restarting io-media.  You'll 
have to either use the io-media API or testapp-cmdline to do that; 
here's a testapp-cmdline script that will set the debug level to a value 
given in a command-line argument (it must be the numeric value of a 
_SLOG_xxx macro):

   #! testapp-cmdline -c debug
   ifndef verbosity
     echo *** Setting to the default verbosity (5)
     echo *** use -D verbosity=x to change
     local verbosity 5
   fi
   SetResource verbosity i32 %verbosity
   quit

Run it like this:

$ testapp-cmdline -c debug -Dverbosity=6 script
000.001 Opened ctrlpnt 'debug'
000.010 Calling iom_set_resource( "verbosity", 6, 4 )
000.019 Destroying the graph...
000.022 Reader thread exiting
$
Re: Tip #1: Getting logs from MM applications  
> Dan Cardamore wrote:

> For the more advanced users, it has recently become possible to change 
> this verbosity level dynamically, without restarting io-media.  You'll 
> have to either use the io-media API or testapp-cmdline to do that; 
> here's a testapp-cmdline script that will set the debug level to a value 
> given in a command-line argument (it must be the numeric value of a 
> _SLOG_xxx macro):
> 
>    #! testapp-cmdline -c debug
>    ifndef verbosity
>      echo *** Setting to the default verbosity (5)
>      echo *** use -D verbosity=x to change
>      local verbosity 5
>    fi
>    SetResource verbosity i32 %verbosity
>    quit
> 
> Run it like this:
> 
> $ testapp-cmdline -c debug -Dverbosity=6 script
> 000.001 Opened ctrlpnt 'debug'
> 000.010 Calling iom_set_resource( "verbosity", 6, 4 )
> 000.019 Destroying the graph...
> 000.022 Reader thread exiting
> $

The testapp-cmdline debug application is not included in these archives, but you could apply the same method thru src 
code:

 int set_verbosity( int32_t lvl ) {
    int result = -1;
    int fd;
    if ( ( fd = iom_open_ctrlpnt( "debug", 0 ) ) >= 0 ) {
        result = iom_set_resource( fd, "verbosity", &lvl, sizeof lvl );
        iom_close_ctrlpnt( fd );
    }
    return result;
  }