Import the log4j jar package,Make the following configuration in Web. xmllog4j Configuration - Context-param> Param-name>WebapprootkeyParam-name> Param-value>Myapplication.rootParam-value> Context-param> Context-param> Param-name>Log4jconfiglocationParam-name> Param-value>/web-inf/log4j.propertiesParam-value> Context-param>
Note: this information is searched through the network and then sorted into
First of all, to explain the parameters of the configuration file, so that the configuration can be reasonable.
Description of parameter meaning:
Configure Root Logger
Its syntax is:
Log4j.rootlogger = [level], appenderName1, appenderName2, ...
Level: Is the priority of the logging, divided into
the levels you define by off, FAT
The solution to log4j problems caused by setting up the spring DM 2.0 Environment is:
1. Introduce the bundle of springdm2.0, as shown in the following figure:
Note: slf4j. API, slf4j. log4j, slf4j.org. Apache. commons. logging, and org. Apache. log4j are jar related to springdm log processing. However, the log system cannot be started normally when only the fo
= Response.getoutputstream ();
Out.println ("
1.6 Building Two JSP pagesA successful page refreshsuccess.jsp, the code is as follows
And a failed page refreshfailed.jsp, the code is slightly
1.7 Configuring Spring's Bean file (Service)Beanreflog4j.xml
1.8 Configuring Spring's Bean file (MVC)Beanrefmvc.xml
1.9 Introduce these two Spring profiles into your existing applications, or adjust them to your project structure
1.10 Configuring Web.xml FilesAdd the
First, the program error
Warning: Yellow Line: Warning
Error: Resource class: System level (thread)/ Environment level (drawing)
exception: Compile level: Exception
Run Level: Exception-RuntimeExceptionSecond, abnormal operation
Enter an unmatched exception: Inputmismatchexception
Arithmetic Exceptions: ArithmeticException:/By zero
Array subscript out- of-bounds exception: ArrayIndexOutOfBoundsException
number Format exception: NumberFormatException
The simple configuration of log4j makes it more and more applications: The log4j configuration file realizes output to console, file, rollback file, send log mail, output to database log table, custom label and so on. Choose its one or two use is enough, Log4j.rootlogger=debug,console,a1,im log4j.addivity.org.apache=tr
# Rootlogger is the root log of all logs. modifying this log attribute will take effect for all logs.# In the following attribute configuration, the output level of all logs is info, and the output source is ConsoleLog4j. rootlogger = info, console# Define the output location of the output source as the ConsoleLog4j. appender. Console = org. Apache. log4j. leleappender# Define the class used for the layout
Reference articleshttp://willow-na.iteye.com/blog/347340(1) configuration fileHere is the code that came directly from that article, made some changes, and will also fill in some other content, I hope the original author does not mindXML version= "1.0" encoding= "UTF-8"?>DOCTYPE log4j:configuration SYSTEM "Log4j.dtd"> log4j:configurationxmlns:log4j= ' http://jakarta.apache.org/log4j/' > Appendername=
You need 4 jar packages first. As followsHttp://pan.baidu.com/s/1i4k3fiHThe following package is included in the interim and can be placed in the project Lib.In addition to the need for a configuration file, the sharing link is as follows. Http://pan.baidu.com/s/1o7qy2Ky put the configuration file in the location. Name yourself, then go to the project and use it.Import Org.slf4j.Logger;Import Org.slf4j.Logg
The initial setup of my logging frameworkHow to set up my log frame.The original text comes from Http://log4e.jayefem.de/index.php/Log4E:FAQIf you are are already familiar with your logging framework you might want to skip this section.This is chapter gives you a slight idea of how to make the initial setup of your logger. This isn't supported by log4e at the moment and the ' not ' intended use in the beginning of this project.LOG4E does not ship the any logging framework which means, have to do
I recently worked on a project and encountered a problem. I am dizzy! Log4j configuration is correct, but logs cannot be printed on the console! It was initially considered a configuration problem because the project was managed using Maven, and the package issue was not taken into account! I haven't found the reason for this for a long time! It's always the next
log4j The official Appender gives a few implementationsOrg.apache.log4j.ConsoleAppender (console),Org.apache.log4j.FileAppender (file),Org.apache.log4j.DailyRollingFileAppender (generates a log file every day),Org.apache.log4j.RollingFileAppender (creates a new file when the file size reaches the specified size),Org.apache.log4j.WriterAppender (send log information in stream format to any specified location)Actual development we use 1th, 3rd and 4th i
1. Install the plugin net.mihai-nita.ansicon.plugin:Download Net.mihai-nita.ansicon.plugin.zip, extract a plugin directory, copy the parent directory to the Myplugins directory under the Eclipse root directory, as follows:Create the Links folder under the Eclipse root directory and write the plugin path: Path=c:\\applications\\eclipse\\myplugins\\net.mihai-nita.ansicon.pluginFinally, restart Eclispe, plug-in installation is complete.2. Configure log4j:Writing the layout file class Coloredpatterl
the project is actually published, it cannot be done, the efficiency is not said, we can not view these logs.Side dishes of the project with the log4j, it has a configuration file, called Log4j.properties, the configuration is roughly as follows:Log4j.rootlogger = INFO, RLOG4J.APPENDER.R = Org.apache.log4j.RollingFileAppenderLog4j.appender.r.file =/home/westjava
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.