C3P0 log4j:WARN No appenders could be found for logger (com.mchange.v2.log.MLog)

2976 단어 appender
document.domain = "iteye.com";
SSH를 학습하는 과정에서 로그를 설정하고 SLF4J와 LOG4J를 조합하여 데이터베이스 연결 탱크로 c3p0을 만들고 서버를 시작하면 다음과 같은 경고 메시지가 나타납니다.
 
 log4j:WARN No appenders could be found for logger (com.mchange.v2.log.MLog).  log4j:WARN Please initialize the log4j system properly.
 
스프링 설정 감청기가 Log4j 설정 감청기보다 먼저 실행되었기 때문에 해결이 간단합니다. Log4j 설정을 스프링 설정 전에 ok했습니다.
 
다음은 나의 웹이다.xml 프로필:
 
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	id="WebApp_ID" version="2.5">
	<display-name>SSHDemo</display-name>
	<welcome-file-list>
		<welcome-file>index.html</welcome-file>
		<welcome-file>index.htm</welcome-file>
		<welcome-file>index.jsp</welcome-file>
		<welcome-file>default.html</welcome-file>
		<welcome-file>default.htm</welcome-file>
		<welcome-file>default.jsp</welcome-file>
	</welcome-file-list>
	<!-- Struts2 configuration -->
	<filter>
		<filter-name>struts2</filter-name>
		<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

	<!-- Log4j configuration -->
	<context-param>
		<param-name>webAppRootKey</param-name>
		<param-value>sshdemo.root</param-value>
	</context-param>
	<context-param>
		<param-name>log4jConfigLocation</param-name>
		<param-value>/WEB-INF/log4j.properties</param-value>
	</context-param>
	<listener>
		<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
	</listener>

	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>/WEB-INF/applicationContext.xml</param-value>
	</context-param>
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	<listener>
		<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
	</listener>
</web-app>

좋은 웹페이지 즐겨찾기