already contains the functions of Webapprootlistener.General configuration Type the following example: XML code
log4jrefreshinterval in Web. XML
Log4jrefreshinterval is 3000 to open a watchdog thread to scan for changes in configuration files every 3 seconds.
The ability to dynamically modify the Log4j.propert
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=
Webapprootkey of the two projects forXML code Application Path - Context-param> Param-name>WebapprootkeyParam-name> Param-value>Webapp.root1Param-value> Context-param> Application Path - Context-param> Param-name>WebapprootkeyParam-name> Param-value>Webapp.root2Param-value> Context-param>So there will be no conflict.After is defined, the absolute path to root is written to the system variable when the Web Container boot . then
Transferred from: http://blog.csdn.net/arvin_qx/article/details/6829873When deploying two or more projects under Tomcat, it is best to define the Webapprootkey parameter in the Web. xml file and, if undefined, default to "Webapp.root", as follows:It is best to ensure that the parameter values for each item are different to avoid conflicting items:Web App root system property already set to different value: ' webapp.root ' = [C:\Program Files (x86) \ap
When deploying two or more projects under Tomcat, it is best to define the Webapprootkey parameter in the Web. xml file, which, if undefined, defaults to "Webapp.root", as follows:
Best newspaper The parameter values for each item are different to avoid conflicting items
Severity: Exception sending context initialized event to listener instance of class Org.springframework.web.util.Log4jConfigLis TenerJava.lang.IllegalStateException:Web App root syst
Mode:Log4j. appender. appenderName. layout = classNameLog4j. appender. appenderName. layout. Option1 = value1...Log4j. appender. appenderName. layout. OptionN = valueNIi. configuration detailsIn practical applications, configuration files must be set in advance for Log4j to run in the system. The
Add log4j to Web. xml and log4j to Web. xml
The configuration file is as follows. Web. xml
The log4jproperties file exists and is also configured in webxml. Why does it still report the above error?
Modify the
class library, for example, Apache active MQ-which depends on another log class library logback, You need to load it as well. However, if Apache active MQ uses slf4j, you can continue to use your log class library without suffering the pain of loading and maintaining a new log framework.
In general, slf4j makes your code independent from any specific log API, which is a good idea for API developers. Although the idea of the abstract log library is no longer a new thing and Apache commons loggin
Java-based log4j configuration and java-based log4j Configuration
Java-based log4j Configuration
Log4j has many advantages and is easy to use, that is, it is difficult to configure. Nex
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. Conf
(); } /*** Initialization of the servlet. @throwsservletexception * If an error occurs*/ Public voidInit ()throwsservletexception {String file= This. Getinitparameter ("log4j");//read from the Web. XML configuration, the name must be consistent with the Web. XML Configuratio
file (Log4j supports configuration files in two formats, namely, properties files and xml files). (properties file configuration methods are common)
2. Basic Format of properties configuration file:
The log4j. properties
LOG4J is an Apache open source project, through the use of log4j, we can control the log information delivery destination is the console, files, GUI components, even the socket server, NT Event recorder, UNIX syslog daemon, etc. We can also control the output format of each log, and by defining the level of each log information, we can control the log generation process more carefully. Most interesting of a
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.