1, log4j
Overview
Log4j is an open source project for Apache, mainly used to do the log management work in Java development. It is mainly composed of three important components. You can manage the priority of logs, output destinations, and output formats. Its configuration file mainly has XML and properties two kinds of, of course, can also be configured in the program, but the actual development of the general use of properties file.
Components of the log4j
1.1. Prio
1. Simply print the log to the screen
Import loggingLogging.debug (' This are debug message ')Logging.info (' This is info ')Logging.warning (' This are warning message ')Print on screen:WARNING:root:This is WARNING message
By default, logging prints the log to the screen with a log level of warning;The log level size relationship is: CRITICAL > ERROR > WARNING > INFO > DEBUG > NOTSET, and of course you can define the
Official Document: Logging HOWTOOfficial Document: Logging.config moduleThe level of the log is as follows, and the log is logged only if it is greater than or equal to the configured level.# Default level is Warningnotset
The official module has more than 10 Handler (useful handlers), which exist in the logging and logging.handlers modules. Commonly used are:
What is SLF4J?SLF4J is a packaging class, a typical facade model of the tool, the user presents a unified operation, compatible with a variety of mainstream logging framework, typical LOG4J/JDK Logging/nop/simple/jakarta commons logging and so on.There is a picture of the image of the visual display of this knowledge:Here are some examples of MAVEN configurations
Introduction to PHP Error and Logging
The error and logging functions allow you to process and record errors.
The error function allows the user to define fault-handling rules and modify the way in which the errors are logged.
The logging function allows users to log applications and send log messages to e-mail, system logs, or other machines.
PHP Error and
Enterprise Library 2.0 Tip (4): How to Configure Logging Application Block in a programmatic way
In this series of tips (1) and tips (2), respectively, the use of external configuration files, the use of database records configuration information Two methods, do not know if you have not used any configuration files, and do not use the database to directly use the programming method to achieve it? This article will show you how to configure the
Binary logA SQL statement that records committed transactions causing data changes or potentially causing data changes, generating copies of the data through events in the replay log file, independent of the storage engine type.
Binary logs are turned on by default, binary logs and data are stored separately
the ability to turn on binary files:In my.cnf [mysqld], addlog_bin[=/path/somefile]The default binary logs are in the database directory,mariadb-bin.000001is a binary log data
#!/usr/bin/env python# Encoding:utf-8import logging# defines the handler output format formatter=logging. The Formatter ('% (asctime) s--% (name) s--% (filename) s--% (message) s ') #创建一个handler to write to the log file, outputting only log fh=logging above the debug level. The Filehandler (' Test.log ') fh.setformatter (formatter) #再创建一个handler for output to the
Python logging modulePython logging provides a standard logging interface, and the Python logging log is divided into 5 levels:debug(), info(), warning(), error() and critical()Simple usageimport logginglogging.warning("warning.........")logging.critical("server is down")PrintWARNING:root:warning.........CRITICAL:root:
The Logging Application Block in Enterprise Library 2.0 is Logging and Instrumentation Application Block in version 1.0 because it focuses on logging and Renamed as Logging Application Block. Logging Application Block provides a unified
be used to throw exceptions and abstract classes + abstract methods to constrainSecond, the encryption mechanismOur password only we know others do not know, but in Python the existence of the password is too exposed, we need a way to make the password complex can not be cracked1 ImportHashlib#to import the encryption module first2 3obj = Hashlib.md5 (b"ASDAOIJSO")#add salt to prevent the collision of the library, resulting in password leakage4Obj.update ("Admin". Encode ("Utf-8"))#encode and w
When using Xshell for network device configuration maintenance, often need to configure the backup work, when we select "Start Logging", but the start recording time before the log is also recorded, which will cause you to back up the log file has a lot of information is not needed: for example, you show the log before the record IP os nei, and then start logging the profile show run, when you open the log
Ps:linux user operations records are generally viewed through the command history, but if the important data is deleted because someone mistakenly manipulated it, this situation does not work. The following methods can be implemented by logging the login IP address and all users log on the operation of logging!At the end of the/etc/profile configuration file to add the following script code can be implement
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.