We know that when you do the Web, you encounter so-called cross-domain issues.The so-called cross-domain is the browser at the global level prohibits the page from loading or executing any script from a domain different from its source.For example, our locally developed static interface writes AJAX requests that cannot be configured without a server response.Of course, we can put the static interface under the server, such as Tomcat WebApp, or put in the Node Express project static path can be a
, is a JS script file, using NPM start to launch the site will call www. You can see the console output to confirm. The public directory, which contains a number of static files, the default generated items, only stylesheets under a style.css file. JavaScripts subdirectory can be placed JS file, images subdirectory playback picture. The routes directory is placed in the routing module, the previous analysis. You can configure your site's routing here. An HTML template file that is placed in the
Use python's logging module and pythonlogging Module
I. Starting from a use case
To develop a log system, you must output logs to the console and write log files.
Python code
Import logging
# Create a logger
Logger = logging. getLogger ('mylogger ')
Logger. setLevel (logging. DEBUG)
# Create a handler for writing log files
Fh = logging. FileHandler ('
Module-level functions
Logging.getlogger ([name]): Returns a Logger object that returns root if no name is specified logger
Logging.debug (), Logging.info (), logging.warning (), Logging.error (), logging.critical (): Set the log level for root logger
Logging.basicconfig (): Establishes a streamhandler for the logging system with the default formatter, sets the
1. Go to the official Download log4j 2, import jar package, basically you only need to import the following two jar packages on it (xx is a messy version number):
Log4j-core-xx.jar
Log4j-api-xx.jar
2. Import into your project: This will not be said.
3. Start using:
We know that to use the log4j log in a class, you only need to declare the following member variable (in fact not necessarily a member variable, just for convenience)
Copy Code code as follows:
private static
Integration principles of slf4j and Jul, log4j1, log4j2 and LogbackSlf4jLet's start with a simple use case to explain2.1 Simple Use Casesprivate static Logger Logger=loggerfactory.getlogger (Log4jslf4jtest.class);public static void Main (string[] args) {if (logger.isdebugenabled ()) {Logger.debug ("slf4j-log4j debug Message");}if (logger.isinfoenabled ()) {Logger.debug ("slf4j-log4j info message");}if (logg
Python Logging Module TOC
Objective
Design of logging Module
The logical inheritance structure of logger
Log output to multiple I/O devices
Log format and Content rich
The level of logging is also the classification of the log on the level dimension.
You can filter by the level of the Log object and specify output I/O.
Logger primarily responsible for th
Monolog sends your logs to files, sockets, inboxes, databases and various Web services.
Monolog sends your logs to files, to sockets, to mailboxes, to databases or to other networked storage services (clouds). Monolog can be saved to one or more storage media (later stack bubbling processing).
Installation
$ composer require Monolog/monolog
Basic usage (initial impressions)
Pushhandler (New Streamhandler (' Path/to/your.log ', logger::
This article mainly from log4cxx level, layout, format, naming rules, filter several aspects introduced.
First, log4cxx naming rulesLogger is identified by the name of a string class, and the logger name is case-sensitive and has an inherited relationship between the names, with the parent name as the prefix, and the dot number. For example: X.y is X.y.z's father. A root logger (root
Make sure your Python version > Python 2.3 1 from a small case:Cat howto_logging.py #coding=utf8# file name: howto_logging# this file shows how to use logging# made by vasks, email:[emailprotected]import logging# 创建一个logger,级别:DEBUGlogger = logging.getLogger(‘Err_Logger‘)logger.setLevel(logging.DEBUG)# 创建一个handler,用于写入日志文件fh = logging.FileHandler(‘err.log‘)fh.setLevel(logging.DEBUG)# 再创建一个handler,用于输出到控制台ch = logging.StreamHandler()ch.setLevel(logg
Monolog follows the PSR3 interface specification and can easily be replaced with other log class libraries that follow the same specification. Monolog has a good extensibility, through the handler, formatter and processor these interfaces, can be a variety of Monolog class library extension and customization.
Basic usage
Monolog can be installed via GitHub or composer, and the following is the latest version to install using composer:
Composer require Monolog/monologWhat if you don't know wha
handles for you. Node. js works in a different way.Provides static file services
Undoubtedly, the provision of static file services is the core function of Apache. Different from Node. js, you need to configure the static file service in the application. Fortunately, this is very simple. it is well documented and implemented in Express.Logs
Many basic Apache configurations provide you with access logs and error logs. When using Node. js, you may have guessed it. you also need to configure it in
Listening to Li Jian's "legend", knocking on Dell's keyboard, using the WINDOWS10 system, I wrote this blog about the addition of express routing rules.App.js:varExpress = require (' Express ');varPath = require (' path ');varFavicon = require (' Serve-favicon '));varLogger = require (' Morgan ');varCookieparser = require (' Cookie-parser '));varBodyparser = require (' Body-parser '));varRoutes = require ('./routes/index '));//var users = require ('./
introduction of a variety of modulesvarExpress =require(' Express ');varPath =require(' path ');varFavicon =require(' Serve-favicon ');varLogger =require(' Morgan ');varCookieparser =require(' Cookie-parser ');varBodyparser =require(' Body-parser ');//Introduction of two routesvarRoutes =require('./routes/index ');varUsers =require('./routes/users ');//This should be called instantiation of the project.varApp = Express ();//Set the view directory and
version 3.x.
However, in version 4.x, all the middleware except static is removed.
So we need to install it separately.
The table is as follows:
Alibaba Cloud Express 3.0
Alibaba Cloud Express 4.0
BodyParser
Body-parser
Compress
Compression
CookieSession
Cookie-session
Logger
Morgan
CookieParser
Cookie-pa
First, prefaceThis weekend took some time to learn some of node. js. The main is to learn from the big direction. A preliminary understanding of some features, functionality, usage, and framework of node. js.Second, the basisReference: http://www.runoob.com/nodejs/nodejs-tutorial.htmlThird, MVCnode. JS MVC is mostly done with three templates, Express and Express-controller, and Ejs.Express's Learning Address:http://www.expressjs.com.cn/Express-controller Study Address:Https://www.npmjs.com/packa
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.