mirror of
https://github.com/FatttSnake/ClassroomInteraction.git
synced 2026-04-06 05:01:27 +08:00
Optimize project structure, add log4j2.
This commit is contained in:
13
Library/ClassroomInteraction.Library.iml
Normal file
13
Library/ClassroomInteraction.Library.iml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<output url="file:///production/ClassroomInteraction.Library" />
|
||||
<output-test url="file:///test/ClassroomInteraction.Library" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="log4j-core-2.17.2" level="project" />
|
||||
<orderEntry type="library" name="log4j-api-2.17.2" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
15
Library/src/main/ClassroomInteraction.Library.main.iml
Normal file
15
Library/src/main/ClassroomInteraction.Library.main.iml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<output url="file://$MODULE_DIR$/../../build/classes/java/main" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="log4j-core-2.17.2" level="project" />
|
||||
<orderEntry type="library" name="log4j-api-2.17.2" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cfive.classroom.interaction.library.database;
|
||||
package com.cfive.classroom.library.database;
|
||||
|
||||
public class Test {
|
||||
public static void run() {
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.cfive.classroom.interaction.library.net;
|
||||
package com.cfive.classroom.library.net;
|
||||
|
||||
public class Test {
|
||||
public static void run() {
|
||||
36
Library/src/main/resources/log4j2.xml
Normal file
36
Library/src/main/resources/log4j2.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration>
|
||||
<Properties>
|
||||
<!-- 定义日志格式 -->
|
||||
<Property name="log.pattern">[%d{DEFAULT}] [%t/%-5level] %logger{36}: %msg%n</Property>
|
||||
<!-- 定义文件名变量 -->
|
||||
<Property name="file.info.filename">logs/latest21.log</Property>
|
||||
<Property name="file.info.pattern">logs/%d{yyyy-MM-dd}-%i.log.gz</Property>
|
||||
</Properties>
|
||||
<!-- 定义Appender,即目的地 -->
|
||||
<Appenders>
|
||||
<!-- 定义输出到屏幕 -->
|
||||
<Console name="console" target="SYSTEM_OUT">
|
||||
<!-- 日志格式引用上面定义的log.pattern -->
|
||||
<PatternLayout pattern="${log.pattern}" />
|
||||
</Console>
|
||||
<!-- 定义输出到文件,文件名引用上面定义的file.info.filename -->
|
||||
<RollingFile name="file" bufferedIO="true" fileName="${file.info.filename}" filePattern="${file.info.pattern}">
|
||||
<PatternLayout pattern="${log.pattern}" />
|
||||
<Policies>
|
||||
<!-- 根据文件大小自动切割日志 -->
|
||||
<SizeBasedTriggeringPolicy size="1 MB" />
|
||||
</Policies>
|
||||
<!-- 保留最近10份 -->
|
||||
<DefaultRolloverStrategy max="10" />
|
||||
</RollingFile>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="all">
|
||||
<!-- 对info级别的日志,输出到console -->
|
||||
<AppenderRef ref="console" level="all" />
|
||||
<!-- 对info级别的日志,输出到file,即上面定义的RollingFile -->
|
||||
<AppenderRef ref="file" level="all" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
17
Library/src/test/ClassroomInteraction.Library.test.iml
Normal file
17
Library/src/test/ClassroomInteraction.Library.test.iml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<output-test url="file://$MODULE_DIR$/../../build/classes/java/test" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-test-resource" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="ClassroomInteraction.Library.main" />
|
||||
<orderEntry type="library" name="JUnit5.8.1" level="project" />
|
||||
<orderEntry type="library" name="log4j-api-2.17.2" level="project" />
|
||||
<orderEntry type="library" name="log4j-core-2.17.2" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
36
Library/src/test/resources/log4j2.xml
Normal file
36
Library/src/test/resources/log4j2.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration>
|
||||
<Properties>
|
||||
<!-- 定义日志格式 -->
|
||||
<Property name="log.pattern">[%d{DEFAULT}] [%t/%-5level] %logger{36}: %msg%n</Property>
|
||||
<!-- 定义文件名变量 -->
|
||||
<Property name="file.info.filename">logs/latest21.log</Property>
|
||||
<Property name="file.info.pattern">logs/%d{yyyy-MM-dd}-%i.log.gz</Property>
|
||||
</Properties>
|
||||
<!-- 定义Appender,即目的地 -->
|
||||
<Appenders>
|
||||
<!-- 定义输出到屏幕 -->
|
||||
<Console name="console" target="SYSTEM_OUT">
|
||||
<!-- 日志格式引用上面定义的log.pattern -->
|
||||
<PatternLayout pattern="${log.pattern}" />
|
||||
</Console>
|
||||
<!-- 定义输出到文件,文件名引用上面定义的file.info.filename -->
|
||||
<RollingFile name="file" bufferedIO="true" fileName="${file.info.filename}" filePattern="${file.info.pattern}">
|
||||
<PatternLayout pattern="${log.pattern}" />
|
||||
<Policies>
|
||||
<!-- 根据文件大小自动切割日志 -->
|
||||
<SizeBasedTriggeringPolicy size="1 MB" />
|
||||
</Policies>
|
||||
<!-- 保留最近10份 -->
|
||||
<DefaultRolloverStrategy max="10" />
|
||||
</RollingFile>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="all">
|
||||
<!-- 对info级别的日志,输出到console -->
|
||||
<AppenderRef ref="console" level="all" />
|
||||
<!-- 对info级别的日志,输出到file,即上面定义的RollingFile -->
|
||||
<AppenderRef ref="file" level="all" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
Reference in New Issue
Block a user