In the previous article we learned why Python is debugging, and the two methods of Python debugging, but the debugging method is not finished, so in this article we will talk about the remaining two debugging methods. Hopefully, these kinds of debugging methods will help you get on the path to learning python faster.
Logging
breakpoint: # err.py Import pdb s = ' 0 ' n = Int (s) Pdb.set_trace () # Running to here will automatically pause print10/n Running the code, the program will automatically pause in Pdb.set_trace () and go into the PDB debugging environment, you can view the variable with command p, or continue with command C: $ python err.py >/users/michael/github/sicp/err.py (7) Print 10/n (PDB) P n 0 (PDB) C Traceback (most recent): File "err.py", line 7, Print
thinkphp Debug mode and Logging overview, thinkphp logging
This article is described as the use of thinkphp debug mode and logging, which plays a very important role in the development of thinkphp project, it is necessary to understand and grasp. Here's how:
1, can be set i
The python module learns logging and the python module logging.
1. Simply print logs to the screen
Import logginglogging. debug ('this is debug message') logging.info ('this is info message')
This article mainly introduces the benefits of using the logging module in Python to replace print. The main purpose is the simple guide of the logging module. for details about how to use the logging module, refer
Replace print? Print what's wrong?
Print may be the first thing that anyone who learns the
This article introduces the logging module-level functions of the python log module.
Logging. getLogger ([name]): returns a logger object. If no name is specified, the root logger is returned.
Logging. debug (), logging.info (), logging
Replace print? What's wrong with print?
Print is probably the first thing that anyone who learns the Python language touches. Its main function is to print a piece of information to the console, like this:
Copy Code code as follows:
print ' Hello, logging! '
Print is also the most people used to debug their own program with the most thi
Detailed description of Python self-built logging module and python self-built logging Module
Easy to use
At first, we used the shortest code to experience the basic functions of logging.
Import logginglogger = logging. getLogger
Python logging module instance and improvement, python logging instance
Python prints all attribute values of an object:
def prn_obj(obj): print '\n'.join(['%s:%s' % item for item in obj.__dict__.items()])
Python logger object at
This article mainly introduces the Python logging module logging. This article describes Logger, Handler, Formatter, log configuration management, and file configuration management logs, you can refer to the following four logging modules: loggers, handlers, filters, and formatters.
● Loggers: interfaces called By App
The shell record log, eyeful flower of the redirect in line with, looked very uncomfortable there is no! I like Python, just like the feeling of buying a flashlight and a spare battery ready. Logging module is very simple, import module, define the log format. The log can be recorded in the Code through Logging.info (), logging.warning (), Logging.debug (). And immediately feel the whole person a lot better
Independent blog
Proactive debug logging (part 3)
In the previous two sections, we discussed where debugging logs are written and how to classify and classify debugging logs. So far, we have not touched on the core issue: Where should I write debugging logs? How should I write debugging logs? This is the topic of this part.
How to Write debugging logs
The core issue of writing debugging logs is where
This paper describes the usage of thinkphp debug mode and logging, which plays a very important role in the process of thinkphp project development, and it is necessary to understand and master it. The specific methods are as follows:
1, can be set in the config.php, the default is off state.
The opening method is as follows:
' App_debug ' => True
Open the \thinkphp\common\debug.php file t
Thinkphp Learning Notes (iv) debug mode and Logging
Underneath the ornate split line is a concrete implementation that needs to be modified and can be configured:
cong.php
' Config value '//Because the open URL is re-rewritten or not rewritten, can be accessed through the original path//If you want to turn on rewrite mode, you need to do the following//1.query server has opened Apache rewrite module// L
1. Android as a library, in the project can customize some of the controls, in other projects as long as the project is added as a library can be used, as shown in:Note that the following code cannot be added as a library project Androidmanifest.xml:android:icon= "@drawable/ic_launcher"Android:label= "@string/app_name" >Android:name= ". Mainactivity "Android:label= "@string/app_name" >Otherwise, an error occurs when other projects run code. Remember, it seems to add it doesn't matter, need furth
are recorded in spam. log.
When a project is large, logs are used in different files. You can encapsulate the Log into a class for use.
#! /Usr/bin/env python # coding = gbkimport logging, osclass Logger: def _ init _ (self, path, clevel = logging. DEBUG, Flevel = logging.
format is to use the original information. The default time format is:%y-%m-%d%h:%m:%s################################ #3You can use numbers when you set the level or severity. Some constants are built into the logging module, as shown in the following table:#################################Here are some uses of logging:1. Using the logging module in multiple th
Logging in Python
This article mainly introduces the logging module logging in Python, including the Log Level in Python and the use of common methods in the module. For more information, see
Many applications have log modules, wh
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.