Python's logging module

Source: Internet
Author: User

One, logging module

Idle to have no matter, think logging module compare have empty, probably tidy up a bit

Second, the composition of the logging module

Logging module, go inside you will see three packages: Init file, Config,handler

Handler is to deal with some of the content of handler, if you want to make some changes handler can look at this part:

Rotatinghandler (file rotation, file reached the specified size can be changed file)

Timeroatingfilehandler (time file rotation, estimated to be time-based)

。。。。。

Config basically is the processing configuration, we are simple to use, direct simple look at the init file is enough

Three, simple analysis of logging module:

1, some error levels and corresponding numbers, as well as some methods about the log level

  

2, Logger important class:

Filter: Filters, filter the relevant data, see if you want to record

Handler: Dispatcher, log-related handling of the distribution of class log events

Logger Log object, which represents a channel for logging

Formatter format class, controlling the style of the log output

Third, the composition of logging:

1, loggers

2, Handler

3, Filters

4, formatters

Iv. Configuration of logging

1, simple configuration, the default logger object root

2. Code Configuration

3. File configuration

4.

Python's logging module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.