Commit Graph

213 Commits

Author SHA1 Message Date
Jonathan Rose e087ae0c02 Logger: Add manager command 'LoggerRotate' to rotate logger
Part of a series of AMI command equivalents to existing CLI
commands

Review: https://reviewboard.asterisk.org/r/3651/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416848 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-20 20:29:45 +00:00
Kinsey Moore bd36288efa Fix build warnings with TEST_FRAMEWORK enabled
........

Merged revisions 416732 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 416733 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 416734 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416736 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-06-19 19:40:45 +00:00
Matthew Jordan fb5690ce4b Logger/CLI/etc.: Fix some aesthetic issues; reduce chatty verbose messages
This patch addresses some aesthetic issues in Asterisk. These are all just
minor tweaks to improve the look of the CLI when used in a variety of
settings. Specifically:
 * A number of chatty verbose messages were removed or demoted to DEBUG
   messages. Verbose messages with a verbosity level of 5 or higher were -
   if kept as verbose messages - demoted to level 4. Several messages
   that were emitted at verbose level 3 were demoted to 4, as announcement
   of dialplan applications being executed occur at level 3 (and so the
   effects of those applications should generally be less).
 * Some verbose messages that only appear when their respective 'debug'
   options are enabled were bumped up to always be displayed.
 * Prefix/timestamping of verbose messages were moved to the verboser
   handlers. This was done to prevent duplication of prefixes when the
   timestamp option (-T) is used with the CLI.
 * Verbose magic is removed from messages before being emitted to
   non-verboser handlers. This prevents the magic in multi-line verbose
   messages (such as SIP debug traces or the output of DumpChan) from
   being written to files.
 * _Slightly_ better support for the "light background" option (-W) was
   added. This includes using ast_term_quit in the output of XML
   documentation help, as well as changing the "Asterisk Ready" prompt to
   bright green on the default background (which stands a better chance of
   being displayed properly than bright white).

Review: https://reviewboard.asterisk.org/r/3547/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414798 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-28 22:54:12 +00:00
Kinsey Moore abd3e4040b Allow Asterisk to compile under GCC 4.10
This resolves a large number of compiler warnings from GCC 4.10 which
cause the build to fail under dev mode. The vast majority are
signed/unsigned mismatches in printf-style format strings.
........

Merged revisions 413586 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 413587 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 413588 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-05-09 22:49:26 +00:00
Kinsey Moore fe1e8e55a1 Logger: Add dynamic logger channels
This adds the ability to dynamically add and remove logger channels
from Asterisk via the CLI.

(closes issue AST-1150)
Review: https://reviewboard.asterisk.org/r/3185/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407989 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-13 15:51:22 +00:00
Kinsey Moore 6f4a834870 Logger: Fix handling of absolute paths
This fixes path handling for log files so that an extra / is not
appended to the file path when the path is absolute (begins with /).
This would previously result in different but functionally equivalent
paths in the output of 'logger show channels'.
........

Merged revisions 407455 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 407456 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 407458 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407459 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-02-05 20:43:50 +00:00
Richard Mudgett 828f339a9c verbosity: Fix performance of console verbose messages.
The per console verbose level feature as previously implemented caused a
large performance penalty.  The fix required some minor incompatibilities
if the new rasterisk is used to connect to an earlier version.  If the new
rasterisk connects to an older Asterisk version then the root console
verbose level is always affected by the "core set verbose" command of the
remote console even though it may appear to only affect the current
console.  If an older version of rasterisk connects to the new version
then the "core set verbose" command will have no effect.

* Fixed the verbose performance by not generating a verbose message if
nothing is going to use it and then filtered any generated verbose
messages before actually sending them to the remote consoles.

* Split the "core set debug" and "core set verbose" CLI commands to remove
the per module verbose support that cannot work with the per console
verbose level.

* Added a silent option to the "core set verbose" command.

* Fixed "core set debug off" tab completion.

* Made "core show settings" list the current console verbosity in addition
to the root console verbosity.

* Changed the default verbose level of the 'verbose' setting in the
logger.conf [logfiles] section.  The default is now to once again follow
the current root console level.  As a result, using the AMI Command action
with "core set verbose" could again set the root console verbose level and
affect the verbose level logged.

(closes issue AST-1252)
Reported by: Guenther Kelleter

Review: https://reviewboard.asterisk.org/r/3114/
........

Merged revisions 405431 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 405432 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405436 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-14 18:14:02 +00:00
Richard Mudgett 4bde62eb40 Logging callid: Fix some sizeof() references per coding guidelines.
........

Merged revisions 405281 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 405282 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405284 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-10 18:17:48 +00:00
Kevin Harwell b7bb1de4d2 Logging: Logging types ignored after specifying a verbose level
If one specified a verbose level within a logging facility in
logger.conf then any component after it was ignored.  Fixed so
all values are correctly read.

(closes issue ASTERISK-22456)
Reported by: Kevin Harwell
........

Merged revisions 401833 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 401835 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@401836 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-10-24 21:06:14 +00:00
Kevin Harwell 2d091df520 Fix memory leak in logger.
Fixed a memory leak discovered in the logger where a temporary string buffer
was not being freed.

(closes issue ASTERISK-22540)
Reported by: John Hardin
........

Merged revisions 399513 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 399514 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@399515 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-20 14:26:44 +00:00
Kevin Harwell 667fa56b1b Remote console: more output discrepancies
The remote console continued to have issues with its output.  In this case CLI
command output would either not show up (if verbose level = 0) or would contain
verbose prefixes (if verbose level > 0) once log messages were sent to the
remote console.  The fix now now adds verbose prefix data to all new lines
contained in a verbose log string.

(closes issue ASTERISK-22450)
Reported by: David Brillert
(closes issue AST-1193)
Reported by: Guenther Kelleter
Review: https://reviewboard.asterisk.org/r/2825/
........

Merged revisions 399267 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 399268 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@399269 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-17 18:44:11 +00:00
Kevin Harwell d7b9a702d8 Verbose logging discrepancies
Refactored cases where a combination of ast_verbose/options_verbose were
present.  Also in general tried to eliminate, in as many places as possible,
where the options_verbose global variable was being used.  Refactored the way
local and remote consoles handle verbose message logging in an attempt to
solve the various discrepancies that sometimes would show between the two.

(closes issue AST-1193)
Reported by: Guenther Kelleter
Review: https://reviewboard.asterisk.org/r/2798/
........

Merged revisions 397948 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 397958 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397959 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-29 22:49:24 +00:00
Richard Mudgett 46b9e5450f Fix memory corruption when trying to get "core show locks".
Review https://reviewboard.asterisk.org/r/2580/ tried to fix the mismatch
in memory pools but had a math error determining the buffer size and
didn't address other similar memory pool mismatches.

* Effectively reverted the previous patch to go in the same direction as
trunk for the returned memory pool of ast_bt_get_symbols().

* Fixed memory leak in ast_bt_get_symbols() when BETTER_BACKTRACES is
defined.

* Fixed some formatting in ast_bt_get_symbols().

* Fixed sig_pri.c freeing memory allocated by libpri when MALLOC_DEBUG is
enabled.

* Fixed __dump_backtrace() freeing memory from ast_bt_get_symbols() when
MALLOC_DEBUG is enabled.

* Moved __dump_backtrace() because of compile issues with the utils
directory.

(closes issue ASTERISK-22221)
Reported by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/2778/
........

Merged revisions 397525 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 397528 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397570 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23 18:07:40 +00:00
Matthew Jordan c43f380d03 Add backtrace generation to MALLOC_DEBUG memory corruption reports
This patch allows astmm to access the backtrace generation code in Asterisk.
When memory is allocated, a backtrace is created and stored with the memory
region that tracks the allocation. If a memory corruption is detected, the
backtrace is printed to the astmm log. The backtrace will make use of the
BETTER_BACKTRACES build option if available.

As a result, this patch moves the backtrace generation code into its own file
and uses the non-wrapped versions of the C library memory allocation routines.
This allows the memory allocation code to safely use the backtrace generation
routines without infinitely recursing.

Review: https://reviewboard.asterisk.org/r/2567


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391012 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-08 22:09:07 +00:00
Matthew Jordan c1b51fd265 Print all logger messages on shutdown
When Asterisk shuts down and shuts down the loggin gsubsystem, any
messages currently in flight will not get logged. This patch prevents the
loop writing messages from breaking out prematurely, such that all of the
messages are logged.

(closes issue ASTERISK-21716)
Reported by: Corey Farrell
patches:
  logger-process-all-messages.patch uploaded by Corey Farrell (license 5909)
........

Merged revisions 389676 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 389677 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389680 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-24 11:57:48 +00:00
Michael L. Young 54424c2ee2 Fix Missing CALL-ID When Logging Through Syslog
The CALL-ID (ie [C-00000074]) is missing when logging to syslog.  This was just
an oversight when this feature was added.

* Add CALL-IDs when using syslog

(closes issue ASTERISK-21430)
Reported by: Nikola Ciprich
Tested by: Nikola Ciprich, Michael L. Young
Patches:
    asterisk-21430-syslog-callid_trunk.diff by Michael L. Young (license 5026)

Review: https://reviewboard.asterisk.org/r/2526/
........

Merged revisions 388605 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388617 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-05-13 21:21:03 +00:00
Kinsey Moore e6b5e3a62a Ensure that logmsgs are freed properly
Messages sent while the logger thread is shutting down will now have
their associated callid freed properly.
........

Merged revisions 382574 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@382575 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-07 15:09:01 +00:00
Kevin Harwell 71bce17720 Stopped spamming of debug messages during attended transfer.
While autoservice is running and servicing a channel the callid is being stored
and removed in the thread's local storage for each iteration of the thread loop.
If debug was set to a sufficient level the log file would be spammed with callid
thread local storage debug messages.

Added a new function that checks to see if the callid to be stored is different
than what is already contained (if anything).  If it is different then
store/replace and log, otherwise just leave as is.  Also made it so all logging
of debug messages pertaining to the callid thread storage outputs only when
TEST_FRAMEWORK is defined.

(issue ASTERISK-21014)
(closes issue ASTERISK-21014)
Report by: Rusty Newton
Review: https://reviewboard.asterisk.org/r/2324/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381557 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-15 17:38:22 +00:00
Kinsey Moore 2e1e0735fe Revamp of terminal color codes
The core module related to coloring terminal output was old and needed
some love.  The main thing here was an attempt to get rid of the
obscene number of stack-local buffers that were allocated for no other
reason than to colorize some output.  Instead, this uses a simple trick
to allocate several buffers within threadlocal storage, then
automatically rotates between them, so that you can make multiple calls
to the colorization routine within one function and not need to
allocate multiple buffers.

Review: https://reviewboard.asterisk.org/r/2241/
Patches:
    bug.patch uploaded by Tilghman Lesher


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@381448 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-02-14 18:47:56 +00:00
Russell Bryant dfdf3d9909 Add queue_log_realtime_use_gmt option to logger.conf
Add an option that lets you specify that the timestamps going into the realtime
queue log should be in GMT instead of local time.

Review: https://reviewboard.asterisk.org/r/2287/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@380209 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-28 01:50:54 +00:00
Richard Mudgett 9b6d9bcf99 Reduce call-id logging resource usage.
Since there is no need for the call-id logging ao2 object to have a lock,
don't create it with one.
........

Merged revisions 379232 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379233 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-16 18:09:28 +00:00
Richard Mudgett 63bd8de579 Fix logger.c function definition.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@378854 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-09 23:22:00 +00:00
Richard Mudgett 75a037c727 Cleanup logger on exit.
* Cleanup CLI commands, destroy verbosers and logchannels lists on exit.

(issue ASTERISK-20649)
Reported by: Corey Farrell
Patches:
      logger-cleanup-all.patch (license #5909) patch uploaded by Corey Farrell
      Modified
........

Merged revisions 377771 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 377772 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 377773 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@377774 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-11 02:44:53 +00:00
Matthew Jordan 588e90a4d9 Re-initialize logmsgs mutex upon logger initialization to prevent lock errors
Similar to the patch that moved the fork earlier in the startup sequence to
prevent mutex errors in the recursive mutex surrounding the read/write thread
registration lock, this patch re-initializes the logmsgs mutex.  Part of the
start up sequence before forking the process into the background includes
reading asterisk.conf; this has to occur prior to the call to daemon in order
to read startup parameters.  When reading in a conf file, log statements can
be generated.  Since this can't be avoided, the mutex instead is
re-initialized to ensure a reset of any thread tracking information.

This patch also includes some additional debugging to catch errors when
locking or unlocking the recursive mutex that surrounds locks when the
DEBUG_THREADS build option is enabled.  DO_CRASH or THREAD_CRASH will
cause an abort() if a mutex error is detected.

(issue ASTERISK-19463)
Reported by: mjordan
Tesetd by: mjordan
........

Merged revisions 376586 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 376587 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 376588 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-23 00:02:23 +00:00
Andrew Latham 6c20cf2d8a Doxygen Updates - Title update
Update and extend the configuration_file group and enable linking. Commit other cleanups from multi-version Doxygen testing.  Update title that was left behind many years ago.

(issue ASTERISK-20259)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@375182 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-10-18 14:17:40 +00:00
Sean Bright 9d4f8abdc6 Make the casing of CALL_ID in debug messages consistent to satisfy my OCD.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@373142 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-18 20:19:49 +00:00
Jonathan Rose 1a79c9c182 logger: Add rotatestrategy option of 'none' which does not perform rotations
With this option in use, it may be necessary to regulate your log files
externally.

(closes issue ASTERISK-20189)
Reported by: Jaco Kroon
Patches:
    asterisk-logger-norotate-trunk.patch uploaded by Jaco Kroon (license 5671)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372976 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-12 17:13:02 +00:00
Kinsey Moore 9b16c8b0f6 Clean up and ensure proper usage of alloca()
This replaces all calls to alloca() with ast_alloca() which calls gcc's
__builtin_alloca() to avoid BSD semantics and removes all NULL checks
on memory allocated via ast_alloca() and ast_strdupa().

(closes issue ASTERISK-20125)
Review: https://reviewboard.asterisk.org/r/2032/
Patch-by: Walter Doekes (wdoekes)
........

Merged revisions 370642 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 370643 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370655 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-31 20:21:43 +00:00
Matthew Jordan 9bc2127d7b Fix validation errors when producing documentation using default build script
The awk script parses out the first instance of the DOCUMENTATION tag that it
finds within a file.  If a file did not previously have a DOCUMENTATION tag
but received one due to it having an AMI event, then the XML fragment
associated with the AMI event was erroneously placed in the resulting XML
file.  Without the python scripts, these XML fragments will not validate.

This patch adds DOCUMENTATION tags at the top of those files that did
not previously have them to prevent the awk script from pulling AMI event
documentation.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369910 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-11 02:06:05 +00:00
Matthew Jordan 2ffae5745d Add some additional documentation for core AMI events
This patch adds some basic documentation for a number of modules.  This
includes core source files in Asterisk (those in main), as well as
chan_agent, chan_dahdi, chan_local, sig_analog, and sig_pri.  The DTD
has also been updated to allow referencing of AMI commands.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369905 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-10 22:26:27 +00:00
Jonathan Rose 5eb94d7ebb Unique Call ID logging Phases III and IV
Adds call ID logging changes to specific channel drivers that weren't handled
handled in phase II of Call ID Logging. Also covers logging for threads for
threads created by systems that may be involved with many different calls.
Extra special thanks to Richard for rigorous review of chan_dahdi and its
various signalling modules.

review: https://reviewboard.asterisk.org/r/1927/
review: https://reviewboard.asterisk.org/r/1950/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369414 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-26 21:45:22 +00:00
Richard Mudgett a4b545222f Don't waste time initializing the whole call_identifer_str[].
The array is either setup with a callid string or only the first element
needs to be initialized.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369167 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-20 21:33:11 +00:00
Kevin P. Fleming 166b4e2b30 Multiple revisions 369001-369002
........
  r369001 | kpfleming | 2012-06-15 10:56:08 -0500 (Fri, 15 Jun 2012) | 11 lines
  
  Add support-level indications to many more source files.
  
  Since we now have tools that scan through the source tree looking for files
  with specific support levels, we need to ensure that every file that is
  a component of a 'core' or 'extended' module (or the main Asterisk binary)
  is explicitly marked with its support level. This patch adds support-level
  indications to many more source files in tree, but avoids adding them to
  third-party libraries that are included in the tree and to source files
  that don't end up involved in Asterisk itself.
........
  r369002 | kpfleming | 2012-06-15 10:57:14 -0500 (Fri, 15 Jun 2012) | 3 lines
  
  Add a script to enable finding source files without support-levels defined.
........

Merged revisions 369001-369002 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 369005 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369013 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-15 16:20:16 +00:00
Jonathan Rose cd37bec058 logger: Adds additional support for call id logging and chan_sip specific stuff
This patch improves the handling of call id logging significantly with regard
to transfers and adding APIs to better handle specific aspects of logging.
Also, changes have been made to chan_sip in order to better handle the creation
of callids and to enable the monitor thread to bind itself to a particular
call id when a dialog is determined to be related to a callid. It then unbinds
itself before returning to normal monitoring.

review: https://reviewboard.asterisk.org/r/1886/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@366842 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-05-17 16:28:20 +00:00
Mark Murawki f3cde589cd Merged revisions 364635 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r364635 | markm | 2012-04-30 11:51:12 -0400 (Mon, 30 Apr 2012) | 10 lines
  
  Sanatize result from bfd_find_nearest_line (BETTER_BACKTRACES)
  
  bfd_find_nearest_line can possibly set file to null resulting in a crash when strrchr(file) runs
  
  (closes issue ASTERISK-19815)
  Reported by Mark Murawski
  Tested by Mark Murawski
........
........

Merged revisions 364650 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@364654 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-04-30 17:17:51 +00:00
Richard Mudgett 6a540e9087 Fix logger deadlock on Asterisk shutdown.
The logger_thread() had an exit path that failed to release the logmsgs
list lock.

* Make logger_thread() exit path unlock the logmsgs list lock.

* Made ast_log() not queue any messages to the logmsgs list if the
close_logger_thread flag is set.

(issue ASTERISK-19463)
Reported by: Matt Jordan
........

Merged revisions 360933 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 360934 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360935 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-30 21:38:16 +00:00
Jonathan Rose 655a8d4420 Introducing the log message unique call identifiers feature
Log messages will now display a call number that they are tied to (ordered for calls
based on when they started). This feature is made to be minimally invasive without
requiring changes to many of the existing log messages. These IDs  won't show up for
verbose messages on CLI (but they will in log files) This is currently in phase II
of production, see more about this feature on the wiki --
https://wiki.asterisk.org/wiki/display/AST/Unique+Call-ID+Logging

Review: https://reviewboard.asterisk.org/r/1823/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360787 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-29 20:01:20 +00:00
Jonathan Rose d501c2ea2d undoing 360785 due to merging mistake
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360786 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-29 19:59:30 +00:00
Jonathan Rose bf994f0e04 Introducing the log message unique call identifiers feature
Log messages will now display a call number that they are tied to (ordered for calls
based on when they started). This feature is made to be minimally invasive without
requiring changes to many of the existing log messages. These IDs  won't show up for
verbose messages on CLI (but they will in log files) This is currently in phase II
of production, see more about this feature on the wiki --
https://wiki.asterisk.org/wiki/display/AST/Unique+Call-ID+Logging

Review: https://reviewboard.asterisk.org/r/1823/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360785 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-29 19:54:35 +00:00
Kinsey Moore c5b3db1956 Kill off red blobs in most of main/*
Everything still compiled after making these changes, so I assume these
whitespace-only changes didn't break anything (and shouldn't have).


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360190 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-22 19:51:16 +00:00
Russell Bryant 00b270833f Fix bogus reads/writes of console log levels in asterisk.c
This patch updates the NUMLOGLEVELS define in logger.h to 32, to match the fact
that logger.c implements 32 log levels (because of the custom log level stuff).
asterisk.c uses this define to size an array of levels per remote console.

This array is modified in ast_console_toggle_loglevel(), which is called by the
"logger set level" CLI command.  While the documentation for the CLI command
doesn't make it terribly obvious, you can use this CLI command to toggle a
custom log level on a remote console, as well.  However, doing so led to an
invalid array index in asterisk.c.

This array is read from any time a log message is written to a console.  So, 
all custom log level messages resulted in a bogus read if a remote console
was connected.
........

Merged revisions 359259 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 359260 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359261 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-14 10:56:53 +00:00
Tilghman Lesher a78b0af5ea Re-commit the verbose branch.
This change permits each verbose destination (consoles, logger) to have its
own concept of what the verbosity level is.  The big feature here is that
the logger will now be able to capture a particular verbosity level without
condemning each console to need to suffer that level of verbosity.
Additionally, a stray 'core set verbose' will no longer change what will go
to the log.

Review:  https://reviewboard.asterisk.org/r/1599/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355413 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-14 20:27:16 +00:00
Matthew Jordan 9057aa20b6 Backed out core changes from r346391
During testing, it was discovered that there were a number of side effects
introduced by r346391 and subsequent check-ins related to it (r346429,
r346617, and r346655).  This included the /main/stdtime/ test 'hanging',
as well as the remote console option failing to receive the appropriate output
after a period of time.

I only backed out the changes to main/ and utils/, as this was adequate
to reverse the behavior experienced.

(issue ASTERISK-18974)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@347997 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-12-12 19:35:08 +00:00
Tilghman Lesher 77b670c4ab Allow each logging destination and console to have its own notion of the verbosity level.
Review: https://reviewboard.asterisk.org/r/1599


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@346391 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-11-29 18:43:16 +00:00
Richard Mudgett 55b70ae625 Merged revisions 337974 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r337974 | rmudgett | 2011-09-26 14:35:23 -0500 (Mon, 26 Sep 2011) | 37 lines
  
  Merged revisions 337973 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r337973 | rmudgett | 2011-09-26 14:30:39 -0500 (Mon, 26 Sep 2011) | 30 lines
    
    Fix deadlock when using dummy channels.
    
    Dummy channels created by ast_dummy_channel_alloc() should be destoyed by
    ast_channel_unref().  Using ast_channel_release() needlessly grabs the
    channel container lock and can cause a deadlock as a result.
    
    * Analyzed use of ast_dummy_channel_alloc() and made use
    ast_channel_unref() when done with the dummy channel.  (Primary reason for
    the reported deadlock.)
    
    * Made app_dial.c:dial_exec_full() not call ast_call() holding any channel
    locks.  Chan_local could not perform deadlock avoidance correctly.
    (Potential deadlock exposed by this issue.  Secondary reason for the
    reported deadlock since the held lock was part of the deadlock chain.)
    
    * Fixed some uses of ast_dummy_channel_alloc() not checking the returned
    channel pointer for failure.
    
    * Fixed some potential chan=NULL pointer usage in func_odbc.c.  Protected
    by testing the bogus_chan value.
    
    * Fixed needlessly clearing a 1024 char auto array when setting the first
    char to zero is enough in manager.c:action_getvar().
    
    (closes issue ASTERISK-18613)
    Reported by: Thomas Arimont
    Patches:
          jira_asterisk_18613_v1.8.patch (license #5621) patch uploaded by rmudgett
    Tested by: Thomas Arimont
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@337975 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-09-26 19:40:12 +00:00
Richard Mudgett 6896886580 Merged revisions 334954 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r334954 | rmudgett | 2011-09-08 17:28:56 -0500 (Thu, 08 Sep 2011) | 17 lines
  
  Merged revisions 334953 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r334953 | rmudgett | 2011-09-08 17:27:40 -0500 (Thu, 08 Sep 2011) | 10 lines
    
    Fix crash with res_fax when MALLOC_DEBUG and "core stop gracefully" are used.
    
    Asterisk crashes if MALLOC_DEBUG is enabled when res_fax tries to
    unregister its logger level.
    
    * Make ast_logger_unregister_level() use ast_free() instead of free().
    When MALLOC_DEBUG is enabled, ast_free() does not degenerate into a call
    to free().  Therefore, if you allocated memory with a form of ast_malloc
    you must free it with ast_free.
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@334955 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-09-08 22:30:42 +00:00
Alec L Davis 369ea4e7ef log Asterisk Version number, Build etc into each log file
Allow tracking of previous versions through log file records to be tracked.
Each time log file is created or opened, log Asterisk Version, Buildinfo. etc.

alecdavis (license 585)
Tested by: alecdavis
 
Review: https://reviewboard.asterisk.org/r/1409/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@334619 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-09-07 08:06:32 +00:00
Kinsey Moore baa2d1d891 Merged revisions 331654 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r331654 | kmoore | 2011-08-12 11:21:37 -0500 (Fri, 12 Aug 2011) | 19 lines
  
  Merged revisions 331649 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r331649 | kmoore | 2011-08-12 11:20:25 -0500 (Fri, 12 Aug 2011) | 12 lines
    
    Logger does not warn of failure to open logging channels
    
    Currently, logger only prints an error message to stderr when it fails to open
    a logger channel where many users will not see it because the logger lock is
    held.  The alternative provided by this patch is to log the error to all
    attached consoles in the hopes that it will be easier to see.  Additionally,
    this patch prevents the failed logger channel from being added to the list
    where it would silently fail on each call to the Asterisk logger.
    
    (closes issue ASTERISK-16231)
    Review: https://reviewboard.asterisk.org/r/1338
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@331657 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-12 16:22:45 +00:00
Richard Mudgett 9d785ca5f3 Merged revisions 331462 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r331462 | rmudgett | 2011-08-10 15:41:35 -0500 (Wed, 10 Aug 2011) | 37 lines
  
  Merged revisions 331461 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r331461 | rmudgett | 2011-08-10 15:29:59 -0500 (Wed, 10 Aug 2011) | 30 lines
    
    Output of queue log not started until logger reloaded.
    
    ASTERISK-15863 caused a regression with queue logging.  The output of the
    queue log is not started until the logger configuration is reloaded.
    
    * Queue log initialization is completely delayed until the first message
    is posted to the queue log system.  Including the initial opening of the
    queue log file.
    
    * Fixed rotate_file() ROTATE strategy to give the file just rotated out to
    the configured exec function after rotate.  Just like the other strategies.
    
    * Fixed logger reload to always post the queue reload entry instead of
    just if there is a queue log file.
    
    * Refactored some code to eliminate some redundancy and to reduce stack
    utilization.
    
    (closes issue ASTERISK-17036)
    JIRA SWP-2952
    Reported by: Juan Carlos Valero
    Patches:
          jira_asterisk_17036_v1.8.patch (license #5621) patch uploaded by rmudgett
    Tested by: rmudgett
    
    (closes issue ASTERISK-18208)
    Reported by: Christian Pinedo
    
    Review: https://reviewboard.asterisk.org/r/1333/
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@331463 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-10 20:51:07 +00:00
Jason Parker f01e9568d2 Merged revisions 307092 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r307092 | qwell | 2011-02-08 15:24:01 -0600 (Tue, 08 Feb 2011) | 9 lines
  
  Fix issue with verbose messages not showing on remote console.
  
  This code was reworked recently, and since the logchannel list hadn't been
  created yet at this point, and it was a verbose message, it was being dropped
  on the floor.  Now it'll continue on to where it should be handled.
  
  (closes issue #18580)
  Reported by: pabelanger
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@307097 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-02-08 21:24:57 +00:00
Paul Belanger 3556e4c2d4 Replace ast_log(LOG_DEBUG, ...) with ast_debug()
(closes issue #18556)
Reported by: kkm

Review: https://reviewboard.asterisk.org/r/1071/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@306258 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-02-04 16:55:39 +00:00
Tilghman Lesher 793b68b082 Support an alternate configuration file for the 'logger reload' command.
(closes issue #17668)
 Reported by: tilghman
 Patches: 
       20100718__logger_reload_altconf__2.diff.txt uploaded by tilghman (license 14)
 
Review: (by lmadsen, russell within comments on issue tracker)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@300044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-12-31 09:21:47 +00:00
Tilghman Lesher b98e47d119 Merged revisions 298960 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r298960 | tilghman | 2010-12-17 17:52:04 -0600 (Fri, 17 Dec 2010) | 20 lines
  
  Merged revisions 298957 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r298957 | tilghman | 2010-12-17 17:30:55 -0600 (Fri, 17 Dec 2010) | 13 lines
    
    Merged revisions 298905 via svnmerge from 
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r298905 | tilghman | 2010-12-17 15:40:56 -0600 (Fri, 17 Dec 2010) | 6 lines
      
      Let Asterisk find better backtrace information with libbfd.
      
      The menuselect option BETTER_BACKTRACES, if enabled, will use libbfd to search
      for better symbol information within both the Asterisk binary, as well as
      loaded modules, to assist when using inline backtraces to track down problems.

      Review: https://reviewboard.asterisk.org/r/1055/
    ........
  ................
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@298961 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-12-18 00:08:13 +00:00
Jeff Peeler 78bd0de1a9 Add support for several platforms to obtain the real thread ID.
Already had the pthread ID which is not the same.  The most obvious enhancement
is in the "core show threads" output. As stated in the utils header, if the
platform isn't supported -1 is reported (instead of the process ID previously).


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@298137 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-12-12 03:58:33 +00:00
Russell Bryant c0ddaa38d1 Merged revisions 287863 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r287863 | russell | 2010-09-21 08:41:41 -0500 (Tue, 21 Sep 2010) | 2 lines
  
  Fix a regression in verbose logger processing.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@287864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-09-21 13:45:30 +00:00
Brett Bryant 2b1b1c9693 Merged revisions 287639 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r287639 | bbryant | 2010-09-20 17:19:12 -0400 (Mon, 20 Sep 2010) | 8 lines
  
  Fixes an error with the logger that caused verbose messages to be spammed to the
  screen if syslog was configured in logger.conf
  
  (closes issue #17974)
  Reported by: lmadsen
  
  Review: https://reviewboard.asterisk.org/r/915/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@287640 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-09-20 21:25:01 +00:00
Tilghman Lesher 046a2dc3b1 Merged revisions 279390 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r279390 | tilghman | 2010-07-25 12:32:21 -0500 (Sun, 25 Jul 2010) | 8 lines
  
  Don't assume qlog is open.
  
  (closes issue #17704)
   Reported by: vrban
   Patches: 
         issue17704.patch uploaded by pabelanger (license 224)
   Tested by: vrban
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@279391 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-25 17:33:45 +00:00
Tilghman Lesher 82448ad7d2 Separate queue_log arguments into separate fields, and allow the text file to be used, even when realtime is used.
(closes issue #17082)
 Reported by: coolmig
 Patches: 
       20100720__issue17082.diff.txt uploaded by tilghman (license 14)
 Tested by: coolmig


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@278307 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-20 23:23:25 +00:00
Tilghman Lesher c7293780b8 Remove lines from the output related to the backtrace itself.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269936 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-11 18:04:54 +00:00
Kevin P. Fleming 33ba94eb0b Ensure that 'logger show channels' works properly when wildcards are used in logger.conf.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269707 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-10 12:28:17 +00:00
Tilghman Lesher 5d313f51b9 Merged revisions 269635 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r269635 | tilghman | 2010-06-10 02:52:34 -0500 (Thu, 10 Jun 2010) | 9 lines
  
  Ensure restartable system calls can restart (BSD signal semantics).
  
  This eliminates the annoying <beep> on the console.
  
  (closes issue #17477)
   Reported by: jvandal
   Patches: 
         20100610__issue17477.diff.txt uploaded by tilghman (license 14)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@269636 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-06-10 08:15:45 +00:00
Tilghman Lesher fb80119b87 Merged revisions 266142 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r266142 | tilghman | 2010-05-26 16:11:44 -0500 (Wed, 26 May 2010) | 14 lines
  
  Use sigaction for signals which should persist past the initial trigger, not signal.
  
  If you call signal() in a Solaris signal handler, instead of just resetting
  the signal handler, it causes the signal to refire, because the signal is not
  marked as handled prior to the signal handler being called.  This effectively
  causes Solaris to immediately exceed the threadstack in recursive signal
  handlers and crash.
  
  (closes issue #17000)
   Reported by: rmcgilvr
   Patches: 
         20100526__issue17000.diff.txt uploaded by tilghman (license 14)
   Tested by: rmcgilvr
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@266146 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-26 21:17:46 +00:00
Kevin P. Fleming 2aa0c11679 Correct 'all logger levels' patch to work properly.
Nick Lewis pointed out that the patch as committed wouldn't actually include
dynamic logger levels, which was missed by the other reviewers. Thanks!



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-20 12:06:11 +00:00
Kevin P. Fleming e77efbc12e Add ability for logger channels to include *all* levels.
Now that Asterisk modules can dynamically create and destroy logger levels
on demand, it's useful to be able to configure a logger channel (console,
file, whatever) to be able to accept log messages from *all* levels, even
levels created dynamically. This patch adds support for this, by allowing
the '*' level name to be used in logger.conf.

Review: https://reviewboard.asterisk.org/r/663/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@264160 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-05-19 15:29:28 +00:00
Leif Madsen d2e1f421fa CLI command logger set level auto complete.
A simple patch to enable auto tab complete.

(closes issue #17152)
Reported by: pabelanger
Patches: 
      0017152.patch uploaded by pabelanger (license 224)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256821 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-12 14:39:37 +00:00
Tilghman Lesher 4e1e6820db Merged revisions 248582 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r248582 | tilghman | 2010-02-24 15:02:18 -0600 (Wed, 24 Feb 2010) | 7 lines
  
  Remove color code sequences from verbose messages that go to logfiles.
  (closes issue #16786)
   Reported by: dodo
   Patches: 
         logger2.patch uploaded by dodo (license 989)
   Tested by: tilghman
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@248584 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-24 21:17:26 +00:00
Tilghman Lesher ba10edfcac Initialize a variable that we check immediately upon startup.
(closes issue #15973)
 Reported by: atis


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@221920 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-10-02 03:04:34 +00:00
Sean Bright 0c99f79a76 Correct the return value check for ast_safe_system.
The logic here was reversed as ast_safe_system returns -1 on error and not on
success.  Fix suggested by reporter.

(closes issue #15667)
Reported by: loic


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@212574 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-08-17 18:18:16 +00:00
Russell Bryant 0264eef115 Merge the new Channel Event Logging (CEL) subsystem.
CEL is the new system for logging channel events.  This was inspired after
facing many problems trying to represent what is possible to happen to a call
in Asterisk using CDR records.  For more information on CEL, see the built in
HTML or PDF documentation generated from the files in doc/tex/.

Many thanks to Steve Murphy (murf) and Brian Degenhardt (bmd) for their hard
work developing this code.  Also, thanks to Matt Nicholson (mnicholson) and
Sean Bright (seanbright) for their assistance in the final push to get this
code ready for Asterisk trunk.

Review: https://reviewboard.asterisk.org/r/239/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203638 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-26 15:28:53 +00:00
Sean Bright 4535305772 Move syslog utility functions into a separate file so they can be re-used.
This has the pleasant side effect of cleaning up the header inclusion process
in logger.c.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203508 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-25 23:54:03 +00:00
Sean Bright ca3a181c33 Pass a logmsg to ast_log_vsyslog instead of separate arguments.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@203188 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-25 17:01:32 +00:00
Kevin P. Fleming 82fb56886e More 'static' qualifiers on module global variables.
The 'pglobal' tool is quite handy indeed :-)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@200620 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-15 17:34:30 +00:00
Joshua Colp ea89db8ce0 Fix an incorrect call to ast_string_field_free_memory which caused a crash in the logger.
Since the message structure is allocated using ast_calloc_with_stringfields we do not need to
free the memory used for the stringfields as it will get freed when the message structure is.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@197570 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-28 15:23:29 +00:00
Kevin P. Fleming d1e0b11343 Add ability for modules to dynamically register logger levels
This patch adds the ability for modules to dynamically create logger levels for their own use; these are named levels just like the built-in levels, and can be directed to any destination that the logger can send any level to, by including their names in logger.conf.

Review: https://reviewboard.asterisk.org/r/244/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@194610 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-15 13:13:47 +00:00
Tilghman Lesher c524f905a6 Two fixes found while debugging with ast_backtrace():
1) If MALLOC_DEBUG is used when concurrently using ast_backtrace, the free()
used in that routine will trigger an error, because the memory was allocated
internally to libc, where we could not intercept that call to wrap it.
Therefore, it's not memory we knew about, and the free is reported as an
error.

2) Now that channels are objects, the old hack of initializing a channel
to all zeroes no longer works, since we may try to call something like
ast_channel_lock() within a function on that reference.  In that case, it's
reported as an error, because the pointer isn't an object reference.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@194101 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-13 00:13:43 +00:00
Kevin P. Fleming 7893ab8fe7 Merged revisions 193193 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r193193 | kpfleming | 2009-05-08 09:03:28 -0500 (Fri, 08 May 2009) | 7 lines
  
  Make absolute paths for logger channels work properly
  
  (Note: This is not a new feature, it was previously undocumented and broken.)
  
  The Asterisk logger has a feature to support absolute pathnames for logger channels, but the code implementing the feature was broken. This has been fixed, and the absolute path feature is now documented in the sample logger.conf.
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@193194 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-08 14:06:15 +00:00
Kevin P. Fleming a3af213506 Remove rarely-used event_log/LOG_EVENT support
In discussions today at the Europe Asterisk Developer Meet-Up, we determined that
the event_log was used in only 9 places in the entire tree, and really was not needed
at all. The users have been converted to use LOG_NOTICE, or the messages have been
removed since other messages were already in place that provided the same information.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@191785 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-02 19:02:22 +00:00
Kevin P. Fleming b8b4d01b06 Fix an error in queue_log file rotation optimization code
This code was copy-and-pasted without properly changing references to event_rotate into queue_rotate, so under some conditions the log rotation would rotate queue_log even though it was not necessary.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@191775 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-02 18:39:48 +00:00
Russell Bryant cba19c8a67 Convert the ast_channel data structure over to the astobj2 framework.
There is a lot that could be said about this, but the patch is a big 
improvement for performance, stability, code maintainability, 
and ease of future code development.

The channel list is no longer an unsorted linked list.  The main container 
for channels is an astobj2 hash table.  All of the code related to searching 
for channels or iterating active channels has been rewritten.  Let n be 
the number of active channels.  Iterating the channel list has gone from 
O(n^2) to O(n).  Searching for a channel by name went from O(n) to O(1).  
Searching for a channel by extension is still O(n), but uses a new method 
for doing so, which is more efficient.

The ast_channel object is now a reference counted object.  The benefits 
here are plentiful.  Some benefits directly related to issues in the 
previous code include:

1) When threads other than the channel thread owning a channel wanted 
   access to a channel, it had to hold the lock on it to ensure that it didn't 
   go away.  This is no longer a requirement.  Holding a reference is 
   sufficient.

2) There are places that now require less dealing with channel locks.

3) There are places where channel locks are held for much shorter periods 
   of time.

4) There are places where dealing with more than one channel at a time becomes 
   _MUCH_ easier.  ChanSpy is a great example of this.  Writing code in the 
   future that deals with multiple channels will be much easier.

Some additional information regarding channel locking and reference count 
handling can be found in channel.h, where a new section has been added that 
discusses some of the rules associated with it.

Mark Michelson also assisted with the development of this patch.  He did the 
conversion of ChanSpy and introduced a new API, ast_autochan, which makes it 
much easier to deal with holding on to a channel pointer for an extended period 
of time and having it get automatically updated if the channel gets masqueraded.
Mark was also a huge help in the code review process.

Thanks to David Vossel for his assistance with this branch, as well.  David 
did the conversion of the DAHDIScan application by making it become a wrapper 
for ChanSpy internally.

The changes come from the svn/asterisk/team/russell/ast_channel_ao2 branch.

Review: http://reviewboard.digium.com/r/203/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190423 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-24 14:04:26 +00:00
Kevin P. Fleming 2f048030bd revert addition of LOG_SECURITY log channel; after further discussion, a much better solution will be used
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187636 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-10 15:11:16 +00:00
Kevin P. Fleming b5f8c632df add a dedicated log channel for modules to be able report security-related events, so that they can be fed into external processes for analysis and possible mitigation efforts
(inspired by this evening's Toronto Asterisk Users Group meeting and previous dicussions amongst various community members)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187269 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-09 02:44:27 +00:00
Mark Michelson e32921415f Assist proper thread synchronization when stopping the logger thread.
I was finding that on my dev box, occasionally attempting to "stop now" in
trunk would cause Asterisk to hang. I traced this to the fact that the logger
thread was waiting on a condition which had already been signalled. The logger
thread also need to be sure to check the value of the close_logger_thread variable.

The close_logger_thread variable is only checked when the list of logmessages is empty.
This allows for the logger thread to print and free any pending messages before exiting.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@176174 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-02-16 18:25:57 +00:00
Matthew Nicholson 23755124ba Added a comment to logger.c about where to put includes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168054 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-09 18:01:26 +00:00
Matthew Nicholson f42c44449a Use ast_safe_system() in logger.c instead of system()
(closes issue #14194)
Reported by: pabelanger


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168014 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-01-09 16:32:34 +00:00
Tilghman Lesher c8223fc957 Merge ast_str_opaque branch (discontinue usage of ast_str internals)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163991 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-13 08:36:35 +00:00
Eliel C. Sardanons 1e8e12efcf Janitor, use ARRAY_LEN() when possible.
(closes issue #13990)
Reported by: eliel
Patches:
      array_len.diff uploaded by eliel (license 64)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161218 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-05 10:31:25 +00:00
Kevin P. Fleming 887e28d7aa incorporates r159808 from branches/1.4:
------------------------------------------------------------------------
r159808 | kpfleming | 2008-11-29 10:58:29 -0600 (Sat, 29 Nov 2008) | 7 lines

update dev-mode compiler flags to match the ones used by default on Ubuntu Intrepid, so all developers will see the same warnings and errors

since this branch already had some printf format attributes, enable checking for them and tag functions that didn't have them

format attributes in a consistent way


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

in addition:

move some format attributes from main/utils.c to the header files they belong in, and fix up references to the relevant functions based on new compiler warnings



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@159818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-29 17:57:39 +00:00
Terry Wilson d66a8cd264 Fix checking for CONFIG_STATUS_FILEINVALID so that modules don't crash upon trying to parse an invalid config
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-19 19:25:14 +00:00
Tilghman Lesher afb571ba8f Starting with a change to ensure that ast_verbose() preserves ABI compatibility
in 1.6.1 (as compared to 1.6.0 and versions of 1.4), this change also
deprecates the use of Asterisk with FreeBSD 4, given the central use of va_copy
in core functions.  va_copy() is C99, anyway, and we already require C99 for
other purposes, so this isn't really a big change anyway.  This change also
simplifies some of the core ast_str_* functions.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157639 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-19 01:02:45 +00:00
Kevin P. Fleming bd4eb070f3 bring over all the fixes for the warnings found by gcc 4.3.x from the 1.4 branch, and add the ones needed for all the new code here too
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@153616 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-02 18:52:13 +00:00
Sean Bright 790fde68d9 Another batch of files from RSW. The remaining apps and a few more
files from main/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@137089 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-08-10 20:23:50 +00:00
Kevin P. Fleming fd845ffb5e minor change to test automerge
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@133819 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-25 20:56:43 +00:00
Mark Michelson 115937b7a6 Print the correct PID in log messages. Prior to
this commit, only the logger thread's PID would
be printed.

(closes issue #13150)
Reported by: atis
Patches:
      log_pid.diff uploaded by putnopvut (license 60)
Tested by: eliel




git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@133448 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-24 19:53:37 +00:00
Tilghman Lesher e9bd35a0fe Fix rotate strategy
(Closes issue #13086)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@131166 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-16 00:52:48 +00:00
Brett Bryant d185405755 Janitor project to convert sizeof to ARRAY_LEN macro.
(closes issue #13002)
Reported by: caio1982
Patches:
      janitor_arraylen5.diff uploaded by caio1982 (license 22)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@129045 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-08 16:40:28 +00:00
Luigi Rizzo e2807b69a3 use %p to print a pointer
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@126835 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-01 12:29:31 +00:00
Michiel van Baak 8e8359465b Older versions of GNU gcc do not allow 'NULL' as sentinel.
They want (char *)NULL as sentinel.
An example is OpenBSD (confirmed on 4.3) that ships with gcc 3.3.4

This commit introduces a contstant SENTINEL which is declared as:
#define SENTINEL ((char *)NULL)

All places I could test compile on my openbsd system are converted.
Update CODING-GUIDELINES to tell about this constant.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@124127 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-19 20:48:33 +00:00
Russell Bryant 8b0ea3a76d Do a deep copy of file and function strings to avoid a potential crash when
modules are unloaded.

(closes issue #12780)
Reported by: ys
Patches:
      logger.diff uploaded by ys (license 281)
	  -- modified by me for coding guidelines


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@119892 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-06-03 13:29:16 +00:00
Brett Bryant 5b8e1963c5 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 #10891)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@119126 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-29 21:30:37 +00:00
Mark Michelson 975a848b67 A new feature thanks to the fine folks at Switchvox!
If a deadlock is detected, then the typical lock information will be
printed along with a backtrace of the stack for the offending threads.
Use of this requires compiling with DETECT_DEADLOCKS and having glibc
installed.

Furthermore, issuing the "core show locks" CLI command will print the
normal lock information as well as a backtraces for each lock. This
requires that DEBUG_THREADS is enabled and that glibc is installed.

All the backtrace features may be disabled by running the configure
script with --without-execinfo as an argument



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@118173 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-05-23 22:35:50 +00:00