Many programmers have the need to log, and the log contains information that has normal program access logs, there may be errors, warnings and other information output, Python logging module provides a standard log interface, you can store a variety of logs through it, you can store various forms of log , the logging log can be divided into five levels: Debug (), info (), warning (), error (), and Critical
SpringMVC custom annotation, using AOP to implement the logging method, springmvcaop
Background
In a recent project, when the project is basically completed, the customer proposes to record all business operation logs to the database and extract some key business information (such as the transaction order number) it is reflected in logs.
In order to ensure the duration, after reviewing the materials, we decided to use the AOP + custom annotation metho
Use of the Log4jdbc database access logging framework
Log4jdbc official website address
Http://code.google.com/p/log4jdbc/
Https://github.com/arthurblake/log4jdbc
The latest version is 1.2. JDBC3 and JDBC4 are supported.
Log4jdbc is a log framework at the jdbc layer. It combines all placeholders and parameters for display, facilitating the direct copying of SQL statements to run on the database client.
SQL statements not recorded using log4jdbc:
S
In real life, logging is important. Bank transfer will have a record of the transfer, the aircraft during the flight, there will be a black box (flight data logger) to record everything during the flight. If there are any problems, people can use log data to figure out what exactly happened. Logging is equally important for system development, commissioning, and operation. Without
Logging module:Many programs have logging requirements, and the information contained in the log includes both normal program Access logs and possibly errors, warnings, and other information output. Python's logging module provides a standard log interface through which you can store logs in a variety of formats. Logging's logs can be divided into debug (), info
Logging module:The logging module in the standard library, which was used to solve the problem of print interruption when learning thread safety earlier, describes the function of the logging module.logging modules are thread-safe and do not require any special work from customers.It achieves this by using thread locks; There is a lock to serialize the access to
LOG: In addition to the ability to log exception information, you can also record the normal operation of the program key information.Use log4j for log file Recording classic steps:001. Create a lib folder in the project and copy the downloaded jar package to the folder002. Right-click on the jar package that has been copied , and then perform the operation,There will be an extra project in the project that introduces the external library.003. create a name called log4j.properties file in the
When writing code, it is often necessary to keep track of the process under which logging is used. The simple thing is that the print command prints to the terminal or writes to the file via the Open function. However, with the increase of the code volume, the drawback of the way is not controllable, also highlighted, which is the background of the logging module appears.For the
first, simple to use
Copy the Code code as follows:
Def testlogbasic ():
Import logging
Logging.basicconfig (filename = ' Log.txt ', FileMode = ' a ', level = logging. NOTSET, format = '% (asctime) s-% (levelname) s:% (message) s ')
Logging.debug (' This is a message ')
Logging.info ("This is a info")
Logging.disable (#logging). WARNING
Logging.warning ("This is
ObjectiveThere are a number of ways to implement logging in Java,1. The simplest way to do this is system.print.out, err to print the message directly on the console.2. java.util.logging; After the JDK version 1.4, a log API was provided to write logs to the file.3. log4j, the most powerful way to log logs. You can configure the destination, format, and so on for the log by configuring the. Properties or. xml files.4. Commons-
']['Compression'])#YesPrint(config['topsecret.server.com']['ForwardX11'])#NoPrint(config['bitbucket.org'])# forKeyinchconfig['bitbucket.org']:#Note that a key with default defaults will Print(Key)Print(Config.options ('bitbucket.org'))#same for loop, find all keys under ' bitbucket.org 'Print(Config.items ('bitbucket.org'))#Find all key-value pairs under ' bitbucket.org 'Print(Config.get ('bitbucket.org','Compression'))#Yes Get method section key corresponding to valueAdding and removing chan
Module-level functions
Logging.getlogger ([name]): Returns a Logger object that returns root if no name is specified loggerLogging.debug (), Logging.info (), logging.warning (), Logging.error (), logging.critical (): Setting the log level of root loggerLogging.basicconfig (): Create a Streamhandler for the log system with the default formatter, set the base configuration and add it to root logger
Example: logging_level_example.py
Copy Code code as follows:
Import
Logging Log ModuleHttp://python.usyiyi.cn/python_278/library/logging.html Chinese officialhttp://blog.csdn.net/zyz511919766/article/details/25136485 Clear, essential for getting Startedhttp://my.oschina.net/leejun2005/blog/126713 inheritance is great.http://my.oschina.net/u/126495/blog/464892 Example AnalysisOne: OverviewIn a real project, you need to log some data and log it to a different storage unit, such as a database, text, or push to a graphica
Apache log4j Study Notes:Http://www.cnblogs.com/TopZhujia/archive/2010/05/15/1789993.html
(Xml configuration file)
Below, the configuration file is Properties
Commons-logging + log4j Getting Started Guide [ZT] Original: Zhuang Xiaoli (liigo)Www.liigo.com2005-8-13
Why do I use both commons-logging and log4j? Why not only use one of them?The purpose of commons-Loggin is to provide a unified interface for "A
#申明: This article refers to http://www.cnblogs.com/dahu-daqing/p/7040764.htmlLogging Module Introduction# The logging module is a python built-in standard module that is used primarily for output program run logs # you can set the output log level, log save path, log file rollback, etc. # The following advantages than print # 1. You can set different log levels, output only important information, without having to display a lot of debugging informatio
Original Address:https://www.cnblogs.com/nancyzhu/p/8551506.htmlLogA log is a way to track events that occur when the software is running. The software developer calls the log function in the code to indicate that a particular event has occurred. an event is described by a descriptive message that can optionally contain variable data (that is, potentially different data for each occurrence of an event). events also have the importance of developers attributing events, and importance can also be
-- ============================================
-- LOGGING and NOLOGGING on table and index segments
-- ============================================
In some cases, you can use the log recording mode for the table segment and index segment, or you can use the mode of not logging. For example, you can
In NOLOGGING mode, logs must be recorded in scenarios with data guard or high availability, or even forcibly
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.