Link: http://blog.csdn.net/guoquanyou/article/details/5689652
Do the project is log4j output format parameters annoying, simply put the relevant parts of the API roughly translated, the original see http://logging.apache.org/log4j/docs/api/org/apache/log4j/PatternLayout.html
Parameters
Description
Example
%c
Lists the full name
The following is written in the official log4j API, which is sufficient to explain the difference between logger and category...
public class Category
Extends java. Lang. Object
Implements appenderattachable
This class has been deprecated andReplaced byLogger Subclass. ItWill be kept around to preserve backward compatibility until mid2003.
LoggerIs a subclass of category, I. e. It extendsCategory. In other words, a loggerIsA c
Do the project is log4j output format parameters annoying, simply put the relevant parts of the API roughly translated, the original see http://logging.apache.org/log4j/docs/api/org/apache/log4j/PatternLayout.htmlParameter Description Example%c lists the full name of the logger namespace, and if the addition of the {Suppose the current logger namespace is "A.B.C"
Log4j configuration file is used to set the recorder level, storage device, and layout. It can be connected to key = value format settings or XML format settings. Through configuration, you can create a log4j runtime environment.
1. Configuration FileThe basic format of the log4j configuration file is as follows:# Configure the root Logger
-compromise open source license.
The latest version of log4j, including full source code, class files and documentation can be found here http://logging.apache.org/log4j/.
LOG4J Features:
LOG4J is thread-safe.
Log4j is optimized for speed.
log4j Configuration Sample
#定义根日志级别和输出端 (two outputs defined) Log4j.rootlogger=error,console,orclight #定义第一个输出端, output to console log4j.appender.console=
Org.apache.log4j.ConsoleAppender Log4j.appender.console.layout=org.apache.log4j.patternlayout log4j.appender.console.layout.conversionpattern=%d [%t]%-5p%c (%l)-%m%n #定时第二个输出端, output to a file with a maximum space of 1000KB, Automatically back up after 1000KB, generate new files Log4j.appender.or
the second line
Log4j:warn No Appenders could is found for logger (COM.MCHANGE.V2.LOG.MLOG).
Log4j:warn Please initialize the log4j system properly.
Log4j:warn http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
This error occurs because no log4j configuration file is causing the. Add the Log4j.xml under the classpath and make some configuration
the class on which the exception occurred is also the version of the package and package. When your client sends you a stack trace message, as a developer, you don't need to let them tell you the version of the package they're using. This information is already included in the stack trace information. For more information, refer to "%xthrowable" conversion word.This feature can be very helpful in explainin
Received a demand, through the log4j time print log, requirements described as follows: the need to be able to print the log regularly, the interval can be matched. When it comes to timing, first think of the Dailyrollingfileappender class, various timing, according to Datepattern, this can refer to class SimpleDateFormat class, common some of the regular settings are as follows:
[HTML]View Plain copy print? '.' YYYY-MM: Monthly '. ' YYYY-WW: Weekly '
The Windows Communication Foundation (WCF) Service Tracking Viewer tool helps you analyze diagnostic tracing generated by WCF. The service tracing Viewer provides a way to easily merge, view, and filter trace messages in logs to diagnose, fix, and verify WCF Service problems.Configuration tracking
The information provided by the Diagnostic trail shows what happens during application operations. As the name suggests, you can track the operation from th
project Lib libraryMy project is the project of idea, so Lib is in the directory, but the normal JAVV Web application lib is the web directory2. After placing the jar package, we add a configuration file using log4jPut the configuration file in the Classpath directory, generally our normal situation is placed in the SRC root directory can be?
123456789101112131415161718192021222324252627282930
#定义Log4j输出的日志级别#
Rootlogger configuration, and only the log level is rewritten. OK, others don't move. OK, now post the code:
package org.linkinpark.commons.logtest;
Import Org.apache.log4j.Logger; /** * Create Author: Linkinpark * @ Creation Date: February 23, 2016 * @ Feature Description: This class uses log4j rootlogger default output */public class Log4jtest {public STA
Tic Logger log = Logger.getlogger (Log4jtest.class); /** * @ Creation Date: February 22, 2
The powerful function of log4j is unquestionable, but in practical application it is unavoidable to have a function to output independent log files, how to separate the required content from the original log, and form a separate log file. In fact, as long as the existing log4j based on a little configuration can easily achieve this function.
PHP to Java for some time, recently in learning some of spring's components installation, configuration and use. I learned log4j today. As a project log operations component, it saves a lot of effort to log and log transport storage during the project process.LOG4J is an Apache open source project that uses log4j to control log information delivery destinations for consoles, files, databases, GUI components
not long for me to come here, so I did not participate in it, but many people have gone through it. Of course, I only need to make modifications. This is the problem of the data connection pool. This is really difficult to grasp, so let's talk about it. "As long as money can solve the problem, it is not a problem. As long as there is an "Explicit problem, it is not a problem", a lot of errors are reported in the background, and you know how to solve them. If everything is good, the program runs
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.