Common-loggingcommon-logging is a common log interface provided by Apache. The user is free to choose the third party's log component as a concrete implementation, like log4j, or the logging that comes with the JDK, common-logging will automatically find the log library that is actually used when the program runs by dynamic lookup mechanism. Of course, there is a simple logger implementation of common-logging inside, but the function is very weak. So
using log4j to output logs for Tomcat
Original source:
Geoff Mottram (Geoff at minaret Dot biz).
Placed in the public domain on August, 2004 by the author.
Last Updated:january 27, 2005.
This document is provided ' as is ', without warranty of any kind, express or implied, including and not limited to the Warr Anties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the author is liable for any claim, damages
# -- Log4j. rootlogger: output the log information with the info level to the stdout and file destinations. The definitions of stdout and file can be named in the following code. Levels can be divided into off, fatal, error, warn, info, debug, and all. If off is configured, no information is displayed. If Info is configured, only info, warn is displayed, error Log information, while debug information is not displayed
Purpose:1. Write a fatal-level error to the 2000nt log2. Send email notification to administrators for warn, error, and fatal errors3. Other errors are output directly in the background.
Tutorial steps:Output to 2000nt log1. SetLog4jCopy the nteventlogappender. dll in the compressed package to the WINNT/system32 directory (PS: I will store it in the bin of Alibaba ATC)2. Write the configuration file log4j. properties.
# System log output in 2000Log4j.
Today, it took a day to configure log4j. I didn't expect that it would take so much time. I also asked a lot of people and posted a lot of posts, but I finally got it done, but there are still some problems, thank you.
1. configure a simple Java ProjectNow let's take a look at log4j. propertise.# The level is debug and the two output ends are stdout and R respectively.Log4j. Logger. helloapplogger = debug,
1. log4j. rootcategory = info, stdout, R
This sentence outputs the log information with the info level to the stdout and R destinations. The stdout and R definitions can be named in the following code. Levels can be divided into off, fatal, error, warn, info, debug, and all. If off is configured, no information is displayed. If Info is configured, only info, warn is displayed, but the debug information is not displayed.
2.
the use of log4j/log4e
Original Author: Genius Kylin project group log4j Introduction
Simply put, log4j is the API class library that helps developers with log output management. Its most important characteristic can configure the file to set the priority of the log information flexibly, the output destination of the log information and the output format of the
Key Words: Log copy Log4j-1.2.9.jar to/web-inf/lib directory
It's no use adding Log4j-1.2.9.jar references in Eclipse's Java builder path
Under the copy Log4j-1.2.9.jar to/web-inf/lib
TomcatYou need to automatically find the lib below this directory at startup, and the Eclipse reference is used in development use and, in the absence of a release,
TomcatThes
Document directory
1. Logger
2. appender
3. Layout
1. Introduction to log4j
Log4j is similar to Java. util. Logging. It records some useful information and is a log framework;
Log4j = log for Java
Log framework:
(1) Whether the function parameters are correct;
(2) After the software is released, each step of the user's operations is recorded;
(3) record the
Today, I made a one-day remote log configuration. Due to the lack of documents and strategies, debugging was very difficult. Most of the items searched on the Internet are only code-based and do not describe the principles at all. Finally, the configuration is successful, and now the process is organized as follows.
Summary: socket-based remote log is composed of the server and client. The server needs to start a Java class org.apache.log4j.net. socketserver, and the client uses socketappender.
Configure the relative path of the log file in Log4j
Method 1: the solution is to replace the absolute path with the relative path. In fact, the FileAppender of log4j has such a mechanism, such as log4j. appender. logfile. file =$ {WORKDIR}/logs/app. log"$ {WORKDIR}/" is a variable and will be replaced by the value of "WORKDIR" in System Property. In this way, yo
LOG4J Component Composition
The log4j is composed of three important components:
1. Priority of log information (Logger)
2. Output Destination of log information (Appender)
3. The output format of the log information (Layout).
Profile:
The priority of log information from high to low has error, WARN, INFO, DEBUG, respectively, to specify the importance of this log information;
The output destination
The log is an integral part of the application software, and the Apache Open source project log4j is a powerful log component that provides easy logging. On the Apache website: jakarta.apache.org/log4j can download the latest version of the log4j package for free. An example of getting Started
1. Create a new Java project, import package
Log4j configuration is commonly used. Two methods are generally used:. properties and. xml. The following two simple examples are provided:1. log4j. Properties### Set the levels of info, debug, warn, error, and output location A1, A2 for the org. zblog domain ##Log4j.category.org. zblog = error, A1Log4j.category.org. zblog = info, A2Log4j. appender. A1 = org. Apache. lo
In emphasizing reusable component development today, in addition to developing a reusable log operation class from beginning to end, Apache provides us with a powerful log-handling package-log4j.Log4j is an open source project for Apache, by using log4j, we can control the destination of log information delivery is console, file, GUI component, even interface server, NT Event recorder, UNIX syslog daemon, etc. We can also control the output format of
4Basic log4j Configuration
Log4j consists of three important components: loggers, appenders, and layouts, which respectively indicate the priority of log information, the output destination of log information, and the output format of log information. Supports key = value format setting or XML format setting.
L the priority of log information ranges from high to low, including fatal, error, warn, info, and
the relationship between slf4j log4j Logback
What is the simple Logging façade for Java.
Generally speaking is slf4j is a series of log interface, and log4j Logback is the specific implementation of the log framework. Next, we'll look at their relationship in detail in the official document.
The simple Logging façade for Java (SLF4J) serves as a simple façade or abstraction for various Logging framework
Label: log4j
I. Introduction Log4j is an open-source project of Apache. By using log4j, we can control the log information delivery destination, including the console, files, Gui components, and even the interface service set, NT event recorder, and Unix Syslog daemon; we can also control the output format of each log. By defining the level of each log informa
Configuration log file relative path in http://sharep.blog.51cto.com/539048/143734 log4j
2009-03-30 18:52:55 Tags: log4j leisure career
This article is written more comprehensive, turn around, is to share it, at the same time thank Javaeye on the Zengjinliang, OH method One, the solution is to use the relative path to replace the absolute path, in fact, log4j Fil
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.