6.28.10.1 Configuration functions

The following functions allow the logging module to be configured. Before they can be used, you must import logging.config. Their use is optional -- you can configure the logging module entirely by making calls to the main API (defined in logging itself) and defining handlers which are declared either in logging or logging.handlers.

fileConfig( fname[, defaults])
Reads the logging configuration from a ConfigParser-format file named fname. This function can be called several times from an application, allowing an end user the ability to select from various pre-canned configurations (if the developer provides a mechanism to present the choices and load the chosen configuration). Defaults to be passed to ConfigParser can be specified in the defaults argument.

listen( [port])
Starts up a socket server on the specified port, and listens for new configurations. If no port is specified, the module's default DEFAULT_LOGGING_CONFIG_PORT is used. Logging configurations will be sent as a file suitable for processing by fileConfig(). Returns a Thread instance on which you can call start() to start the server, and which you can join() when appropriate. To stop the server, call stopListening(). To send a configuration to the socket, read in the configuration file and send it to the socket as a string of bytes preceded by a four-byte length packed in binary using struct.pack(">L", n).

stopListening( )
Stops the listening server which was created with a call to listen(). This is typically called before calling join() on the return value from listen().

See About this document... for information on suggesting changes.