[Home]

Summary:ASTERISK-10450: [patch] Add support for setting log levels on remote console
Reporter:James Golovich (jamesgolovich)Labels:
Date Opened:2007-10-04 18:29:10Date Closed:2010-04-08 13:07:16
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/NewFeature
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) asterisk-logconsolepoc.diff.txt
Description:Since there was some interest in being able to enable certain log levels on different remote consoles I threw together this proof of concept patch.  There isn't really any error checking and more work needs to be done, but I thought I would throw it out there for comments.

It adds the cli command "logger set level <level> <state>" that you execute on a channel you want to change state on.  level is the numeric logger level 0-6:
0        "DEBUG",
1        "EVENT",
2        "NOTICE",
3        "WARNING",
4        "ERROR",
5        "VERBOSE",
6        "DTMF"

<state> is on or off

This could be extended to include a command line option for what to include or maybe even a profile or something.  Obviously this would need to have a way to use the real names instead of numbers, but it works for now

****** ADDITIONAL INFORMATION ******

If there is interest in something like this going in then theres more work to be done, but its a start.
Comments:By: James Golovich (jamesgolovich) 2007-10-04 20:56:56

Updated the patch so it takes the log name instead of the number.  Still need an idea for a way to pass this on the command line simply

By: Russell Bryant (russell) 2007-11-13 14:33:41.000-0600

You  mention that you updated the patch to take the name of the log level instead of the number.  But, I don't see that reflected in the patch.

By: James Golovich (jamesgolovich) 2007-11-13 14:58:38.000-0600

The code in handle_set_logger_level does it

+ for (x = 0; x <= NUMLOGLEVELS; x++) {
+ if (!strcasecmp(a->argv[3], levels[x])) {
+ level = x;
+ break;
+ }
+ }

I'm still not sure what the best way to allow levels to be set from the command line is.  Maybe a comma delimited list or using the same argument multiple times to enable/disable each one.

By: Eliel Sardanons (eliel) 2008-05-27 12:50:22

1) I think you should generate the
  e->command with the debug levels like (at runtime):
  "logger set level [DEBUG|ERROR|DTMF|etc..] [enable/true|disable/false] to have      
  autocomplete on the CLI.
  The e->usage too.
2) "Set a specific log level to enables/disabled for this console." -> "Set a specific log level to enable/disable logging for this console."

3) "LEVEL %d STATUS %d", Status 1 or 0 is not a user friendly message, also the LEVEL 0-10. Example: "Level DEBUG, status off"

Thanks in advanced.

By: Digium Subversion (svnbot) 2008-05-29 16:24:17

Repository: asterisk
Revision: 119126

U   trunk/include/asterisk/logger.h
U   trunk/main/asterisk.c
U   trunk/main/logger.c

------------------------------------------------------------------------
r119126 | bbryant | 2008-05-29 16:24:14 -0500 (Thu, 29 May 2008) | 7 lines

Adds support for changing logger settingss on remote consoles with a
new command "logger set level".

i.e. "logger set level debug off"

(closes issue ASTERISK-10450)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=119126

By: Digium Subversion (svnbot) 2008-05-29 16:24:48

Repository: asterisk
Revision: 119127

_U  branches/1.6.0/

------------------------------------------------------------------------
r119127 | bbryant | 2008-05-29 16:24:47 -0500 (Thu, 29 May 2008) | 14 lines

Blocked revisions 119126 via svnmerge

........
r119126 | bbryant | 2008-05-29 16:30:37 -0500 (Thu, 29 May 2008) | 7 lines

Adds support for changing logger settingss on remote consoles with a
new command "logger set level".

i.e. "logger set level debug off"

(closes issue ASTERISK-10450)

........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=119127