The parameter configuration in the log4j configuration file is mainly divided into three parts: Priority configuration, log information output destination configuration, and log information output format configuration.
The log priority ranges from high to low, including error, warn, info, and debug, which are used to specify the importance of the log information;
The log output destination specifies whether the log will be printed to the console or a
1. Logger class
Use the static logger method logger. getrootlogger of the logger class to obtain the rootlogger. All other loggers are instantiated and obtained through the static method logger. getlogger. In this method, logger. getlogger takes the name of the logger as the parameter. Some other basic methods of the logger class are listed below:
Package org. Apache. log4j; Public class logger { // Creation and retrieval methods
First, the foreword:Log4j is an open source project and is widely used as a Java-written log-record package. Due to log4j's outstanding performance, when Log4j was completed, log4j development organization had recommended that Sun replace log4j's Log tool class with jdk1.4 in jdk1.4. But at that time jdk1.4 was nearing completion, so Sun refused to use log4j, and
From: http://dingjun1.javaeye.com/blog/413993
Reprinted:
Http://wangjc-opal.javaeye.com/blog/309924
There is no doubt about the powerful functions of log4j, but in actual applications, it is inevitable that an independent log file needs to be output for a function. How can we separate the required content from the original log, what about creating a separate log file? In fact, you can easily implement this function with a slight configuration based o
Log4j is an open-source log component developed by Apache. log4j can control the delivery of log information to the console, files, and GUI components, and control the output format of each log; the configuration file can be used for flexible configuration to control the log generation process in greater detail. The following is a record of my basic usage of log4j
This article is for reprint study English Original:apache.org, compilation: Importnew-Tengkai Connection: http://www.importnew.com/3046.html About log4j 2 Log4j 2 is an upgraded version of log4j, with significant improvements compared to the previous version log4j 1.x, which improves the functionality of many logback
LOG4J Learning Notes
by Heavyz
2003-04-15
Turn from: http://zooo.51.net/heavyz_cs/notebook/log4j.html
--------------------------------------------------------------------------------
LOG4J Home: http://jakarta.apache.org/log4j
--------------------------------------------------------------------------------
Index
Class diagram of the
The log4j. properties configuration file is described as follows:
# Set root logger level to debug and its only appender to A1
# Log4j has five levels of logger
# Fatal 0
# Error 3
# Warn 4
# INFO 6
# Debug 7
Configure the root logger with the Syntax:
# Log4j. rootlogger = [level], appendername, appendername ,...
Log4j
The log4j. properties configuration file is described as follows:
# Set root logger level to debug and its only appender to A1
# Log4j has five levels of logger
# Fatal 0
# Error 3
# Warn 4
# INFO 6
# Debug 7
Configure the root Logger with the Syntax:
# Log4j. rootlogger = [level], appendername, appendername ,...
Log4j
Log processing is a necessary feature in every project development, and logs are running information that is recorded in other files while the program is running.
There are three purposes for exporting logs in an application:
1 Monitor the change of variables in the code, periodically record the data to the file for other applications for statistical analysis work.
2 tracking code run time trajectory, as the basis for future audits.
3 acts as a debugger in an integrated development environment,
Which library is better for you?
Summary
Does your Java program mess with a lot of System.out.println statements and stack traces (for example, Ex.printstacktrace ()) that are immediately placed. When you add debug information to a class in your project, your information output is interspersed with a lot of information from other developers, making your information difficult to identify and read. Do you use a simple log API and worry that it may not provide the flexibility and ability you need
-- By Blues (zhaochaohua@sina.com)
Part 1 Introduction
The advantages of log4j are:
1. By modifying the configuration file, you can determine where the log information is output (console, file,...) and whether it is output.
In this way, you can print detailed log information in the system development phase to track the system operation, and close the log output after the system is stable, so that while tracking the system operation, also reduces the a
I. Preface
There are too many open-source projects in Java, and this everywhere will definitely catch up with the flourishing of "Hundred Schools of contention" and "Hundred Flowers of Competition" in China's five-generation Ten-Nation period. Using Java technology, we almost do not need to buy Java-supported development products for our projects. We only need to combine and splice an open-source product with the hands of architects, you can make commercial products with excellent flexibility a
Log4j introduction:
Log4j is a powerful logging tool that records operation information in the system and helps administrators analyze and manage related data in the background. You can record the data console, files, interface servers, and GUI components. You can configure or flexibly record the log format through your own configuration to achieve data analysis and system analysis. Well, let's just talk ab
Example of how MyBatis3 outputs SQL using log4j on the console, mybatis3log4j
Why do I need to output SQL statements on the console?
Of course, it is convenient for development and debugging.
If a database-related operation encounters a problem, we can quickly troubleshoot the problem based on the output SQL statement.
Output Information:
[Org. mybatis. spring. SqlSessionUtils]-Creating a new SqlSession[Org. mybatis. spring. SqlSessionUtils]-SqlSess
Log4j external configuration file.
Log4j details:
1. Define the configuration fileLog4j supports two configuration file formats: XML and Java. log4j. properties (Key = value ).
I will give two written files (log4j. xml and log4j. properties)
Configure the relative path of the log file in Log4j [sequent]
This article is based on a complete solution to the problem of "Configuring the relative path of log files in log4j" circulating on the Internet. This blog post has been reproduced several times and has been published to the present. This is a reprinted Article []. We recommend that you read this article to understand the problems solved in this
I have been using logs encapsulated by others for some time. I feel very curious when I have configured logs. Next we will record the common usage of using log4j to process logs.
As for what log4j is, I don't know what it is, and I don't think it is necessary to go too deep for the moment. I only know that it is a good choice to process logs.Game starts
References
1) official PDF document
2) Configure
During application development, logs can be used to debug programs and track program running tracks. During the program running process, you can record the running status of the program and use it for auditing. Log4j is a popular implementation that supports multiple log implementations. This section describes how to use log4j logs. The use of log4j logs includes
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.