log4j2降级到log4j

修好了log4j日志问题

Signed-off-by: Chenx221 <chenx221@yandex.com>
This commit is contained in:
Chenx221 2023-06-16 17:55:09 +08:00
parent 79e2a95f8c
commit eb98f1cb85
15 changed files with 89 additions and 35 deletions

View File

@ -19,17 +19,12 @@
<element id="library" level="project" name="Maven: javax.servlet:javax.servlet-api:4.0.1" />
<element id="library" level="project" name="Maven: jstl:jstl:1.2" />
<element id="library" level="project" name="Maven: junit:junit:4.13.1" />
<element id="library" level="project" name="Maven: log4j:log4j:1.2.16" />
<element id="library" level="project" name="Maven: mysql:mysql-connector-java:8.0.28" />
<element id="library" level="project" name="Maven: org.apache.logging.log4j:log4j-api:2.12.4" />
<element id="library" level="project" name="Maven: org.apache.logging.log4j:log4j-core:2.12.4" />
<element id="library" level="project" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.73" />
<element id="library" level="project" name="Maven: org.apache.tomcat:tomcat-annotations-api:9.0.73" />
<element id="library" level="project" name="Maven: org.hamcrest:hamcrest-core:1.3" />
<element id="library" level="project" name="Maven: org.mybatis:mybatis-spring:2.0.7" />
<element id="library" level="project" name="Maven: org.mybatis:mybatis:3.5.7" />
<element id="library" level="project" name="Maven: org.slf4j:slf4j-api:1.6.1" />
<element id="library" level="project" name="Maven: org.slf4j:slf4j-log4j12:1.6.1" />
<element id="library" level="project" name="Maven: org.springframework.security:spring-security-config:5.7.8" />
<element id="library" level="project" name="Maven: org.springframework.security:spring-security-core:5.7.8" />
<element id="library" level="project" name="Maven: org.springframework.security:spring-security-crypto:5.7.8" />
@ -48,6 +43,7 @@
<element id="library" level="project" name="Maven: taglibs:standard:1.1.2" />
<element id="library" level="project" name="Maven: org.apache.commons:commons-csv:1.10.0" />
<element id="library" level="project" name="Maven: commons-io:commons-io:2.12.0" />
<element id="library" level="project" name="Maven: log4j:log4j:1.2.17" />
</element>
</element>
</root>

View File

@ -6,6 +6,7 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!-- 开启注解扫描 -->
<context:component-scan base-package="cyou.chenx221"/>

View File

@ -0,0 +1,11 @@
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
log4j.logger.your.package.name=INFO, sql
log4j.appender.sql=org.apache.log4j.ConsoleAppender
log4j.appender.sql.layout=org.apache.log4j.PatternLayout
log4j.appender.sql.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

View File

@ -0,0 +1,10 @@
status = warn
appender.console.type = Console
appender.console.name = ConsoleAppender
appender.console.target = SYSTEM_OUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n
rootLogger.level = debug
rootLogger.appenderRef.console.ref = ConsoleAppender

View File

@ -38,11 +38,11 @@
AND sex = #{sex}
</if>
<if test="course !=null">
<if test="course.CourseID != null">
AND c.CourseID = #{course.courseID}
<if test="course.CourseID != -1">
AND c.CourseID = #{course.CourseID}
</if>
<if test="course.CourseName != null">
AND c.CourseName LIKE CONCAT('%', #{course.courseName}, '%')
AND c.CourseName LIKE CONCAT('%', #{course.CourseName}, '%')
</if>
</if>
<if test="classes != null">

View File

@ -3,6 +3,9 @@
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting name="logImpl" value="LOG4J2" />
</settings>
<!-- 配置类型别名 -->
<typeAliases>
<package name="cyou.chenx221.pojo"/>
@ -17,4 +20,5 @@
<mapper resource="mapper/TeacherMapper.xml"/>
<!-- 可以添加其他的映射器配置 -->
</mappers>
</configuration>

View File

@ -322,16 +322,17 @@
</div>
</div>
</div>
<div class="row mb-2">
<div class="col-12">
<label for="sex-select2" style="color: rgba(0,0,0,.6);">性别</label>
<select name="sex" id="sex-select2">
<option value="">请选择性别</option>
<option value="男">男</option>
<option value="女">女</option>
</select>
</div>
</div>
<%-- 修改性别什么鬼--%>
<%-- <div class="row mb-2">--%>
<%-- <div class="col-12">--%>
<%-- <label for="sex-select2" style="color: rgba(0,0,0,.6);">性别</label>--%>
<%-- <select name="sex" id="sex-select2">--%>
<%-- <option value="">请选择性别</option>--%>
<%-- <option value="男">男</option>--%>
<%-- <option value="女">女</option>--%>
<%-- </select>--%>
<%-- </div>--%>
<%-- </div>--%>
<div class="row mb-2">
<div class="col-12">
<div class="form-outline">

View File

@ -3,6 +3,10 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<!-- 其他配置 -->
<!-- ... -->
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
@ -11,6 +15,7 @@
<param-value>classpath:applicationContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>

View File

@ -139,23 +139,28 @@
<artifactId>jackson-annotations</artifactId>
<version>2.12.7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.slf4j</groupId>-->
<!-- <artifactId>slf4j-log4j12</artifactId>-->
<!-- <version>1.6.1</version>-->
<!-- </dependency>-->
<!-- 日志工具包 -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.12.4</version>
</dependency>
<!--日志核心包-->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.12.4</version>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.apache.logging.log4j</groupId>-->
<!-- <artifactId>log4j-api</artifactId>-->
<!-- <version>2.12.4</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash;日志核心包&ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.apache.logging.log4j</groupId>-->
<!-- <artifactId>log4j-core</artifactId>-->
<!-- <version>2.12.4</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>

View File

@ -6,6 +6,7 @@
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!-- 开启注解扫描 -->
<context:component-scan base-package="cyou.chenx221"/>

View File

@ -0,0 +1,11 @@
log4j.rootLogger=WARN, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
log4j.logger.your.package.name=WARN, sql
log4j.appender.sql=org.apache.log4j.ConsoleAppender
log4j.appender.sql.layout=org.apache.log4j.PatternLayout
log4j.appender.sql.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

View File

@ -38,11 +38,11 @@
AND sex = #{sex}
</if>
<if test="course !=null">
<if test="course.CourseID != null">
AND c.CourseID = #{course.courseID}
<if test="course.CourseID != -1">
AND c.CourseID = #{course.CourseID}
</if>
<if test="course.CourseName != null">
AND c.CourseName LIKE CONCAT('%', #{course.courseName}, '%')
AND c.CourseName LIKE CONCAT('%', #{course.CourseName}, '%')
</if>
</if>
<if test="classes != null">

View File

@ -3,6 +3,9 @@
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting name="logImpl" value="LOG4J2" />
</settings>
<!-- 配置类型别名 -->
<typeAliases>
<package name="cyou.chenx221.pojo"/>
@ -17,4 +20,5 @@
<mapper resource="mapper/TeacherMapper.xml"/>
<!-- 可以添加其他的映射器配置 -->
</mappers>
</configuration>

View File

@ -3,6 +3,10 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<!-- 其他配置 -->
<!-- ... -->
<servlet>
<servlet-name>dispatcherServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
@ -11,6 +15,7 @@
<param-value>classpath:applicationContext.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcherServlet</servlet-name>