Python - logging module

logging module

Both configurations logging module logs the output format:

1、
Python - logging module

Output is as follows:

Python - logging module

2、

The second way is as follows:

Python - logging module

note

logger = logging.getLogger() No arguments defaults to the root user.

logger1 = logging.getLogger('mylog') Parameters is to create user

The newly created user is the root user sub-accounts, sub-accounts of the log output delivered to all root accounts Logger process.

Figure root root user opens the screen output, sub-accounts mylog, mylog1 open the screen output is output twice. (MyLog output again, and then passed again processed output root)

Python - logging module

Output:

Python - logging module

Guess you like

Origin blog.51cto.com/11533525/2404804