diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2009-10-10 20:32:36 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2009-10-10 20:32:36 (GMT) |
commit | cbabd7ec3aa589bda8f636f4b23c294604d07c63 (patch) | |
tree | 9e0eee5ad8d7a80d86c16c3258f983f7b774aa4e /Doc | |
parent | bec4d57a392179e23d2eec51db4bdc0806d692ee (diff) | |
download | cpython-cbabd7ec3aa589bda8f636f4b23c294604d07c63.zip cpython-cbabd7ec3aa589bda8f636f4b23c294604d07c63.tar.gz cpython-cbabd7ec3aa589bda8f636f4b23c294604d07c63.tar.bz2 |
Issue #7086: Added TCP support to SysLogHandler and tidied up some anachronisms in the code.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/logging.rst | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst index bdd6809..9dc98fb 100644 --- a/Doc/library/logging.rst +++ b/Doc/library/logging.rst @@ -763,11 +763,13 @@ functions. Does basic configuration for the logging system by creating a :class:`StreamHandler` with a default :class:`Formatter` and adding it to the - root logger. The function does nothing if any handlers have been defined for - the root logger. The functions :func:`debug`, :func:`info`, :func:`warning`, + root logger. The functions :func:`debug`, :func:`info`, :func:`warning`, :func:`error` and :func:`critical` will call :func:`basicConfig` automatically if no handlers are defined for the root logger. + This function does nothing if the root logger already has handlers + configured for it. + The following keyword arguments are supported. +--------------+---------------------------------------------+ @@ -1957,16 +1959,22 @@ The :class:`SysLogHandler` class, located in the :mod:`logging.handlers` module, supports sending logging messages to a remote or local Unix syslog. -.. class:: SysLogHandler(address=('localhost', SYSLOG_UDP_PORT), facility=LOG_USER) +.. class:: SysLogHandler(address=('localhost', SYSLOG_UDP_PORT), facility=LOG_USER, socktype=socket.SOCK_DGRAM) Returns a new instance of the :class:`SysLogHandler` class intended to communicate with a remote Unix machine whose address is given by *address* in the form of a ``(host, port)`` tuple. If *address* is not specified, - ``('localhost', 514)`` is used. The address is used to open a UDP socket. An + ``('localhost', 514)`` is used. The address is used to open a socket. An alternative to providing a ``(host, port)`` tuple is providing an address as a string, for example "/dev/log". In this case, a Unix domain socket is used to send the message to the syslog. If *facility* is not specified, - :const:`LOG_USER` is used. + :const:`LOG_USER` is used. The type of socket opened depends on the + *socktype* argument, which defaults to :const:`socket.SOCK_DGRAM` and thus + opens a UDP socket. To open a TCP socket (for use with the newer syslog + daemons such as rsyslog), specify a value of :const:`socket.SOCK_STREAM`. + + .. versionchanged:: 3.2 + *socktype* was added. .. method:: close() |