logging in python log message the is the message to be logged from the application logger provides the programmers entry point/interface to the logging system the logger class provides variety of methods that can be used to log messages at different levels handler handlers determine where to send log messagedefault handlers include file handlers that send messages to file and http handlers that send messages to web server filter this is an optional element in the logging pipeline they can be used to further filter the information to be logged providing fine grained control of which log messages are actually output (for example to log fileformatter these are used to format the log message as required this may involve adding timestampsmodule and function/method information etc to the original log message configuration information the logger (and associated handlersfilters and formatterscan be configured either programmatically in python or through configuration files these configuration files can be written using key-value pairs or in yaml file (which is simple mark up languageyaml stands for yet another markup languageit is worth noting that much of the logging framework is hidden from the developer who really only sees the loggerthe remainder of the logging pipeline is either configured by default or via log configuration information typically in the form of log configuration file the logger the logger provides the programmers interface to the logging pipeline logger object is obtained from the getlogger(function defined in the logging module the following code snippet illustrates acquiring the default logger and using it to log an error message note that the logging module must be importedimport logging logger logging getlogger(logger error('this should be used with something unexpectedthe output from this short application is logged to the console as this is the default configurationthis should be used with something unexpected