mirror of
https://github.com/LamGC/ContentGrabbingJi.git
synced 2025-04-30 06:37:36 +00:00
[Add] Exec 添加一个预期(?)的启动模块;
[Add] ApplicationMain 程序主入口, 负责初始化项目运行环境和启动项目; [Add] log4j2.xml 使用上一版日志配置, 后续会有调整; [Add] cgj_setting.json 初始配置文件, 需等 Core 模块完成后才会具体编写;
This commit is contained in:
parent
c27d072e68
commit
0841924b13
@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 LamGC
|
||||||
|
*
|
||||||
|
* ContentGrabbingJi is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* ContentGrabbingJi is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.lamgc.cgj;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ContentGrabbingJi 启动主类.
|
||||||
|
*
|
||||||
|
* 请不要在该类,甚至是该模块(指 exec 模块)开发任何与启动项目无关的功能!
|
||||||
|
* @author LamGC
|
||||||
|
*/
|
||||||
|
public class ApplicationMain {
|
||||||
|
|
||||||
|
private final static Logger log = LoggerFactory.getLogger(ApplicationMain.class);
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
log.info("ContentGrabbingJi 正在启动中...");
|
||||||
|
beforeRun();
|
||||||
|
log.info("初始化完成, 正在启动Core...");
|
||||||
|
run();
|
||||||
|
log.info("正在清理运行时内容...");
|
||||||
|
afterRun();
|
||||||
|
log.info("ContentGrabbingJi 退出.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void beforeRun() {}
|
||||||
|
|
||||||
|
private static void run() {}
|
||||||
|
|
||||||
|
private static void afterRun() {}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
|
||||||
|
}
|
59
ContentGrabbingJi-exec/src/main/resources/log4j2.xml
Normal file
59
ContentGrabbingJi-exec/src/main/resources/log4j2.xml
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration status="WARN">
|
||||||
|
<!--
|
||||||
|
测试版跟发布版在日志配置文件上的区别仅仅只有'Loggers'的不同, 'properties'和'Appenders'是一致的.
|
||||||
|
-->
|
||||||
|
<properties>
|
||||||
|
<property name="logStorePath">./logs</property>
|
||||||
|
<property name="charset">UTF-8</property>
|
||||||
|
<property name="standard_pattern">[%-d{HH:mm:ss.SSS} %5level][%logger.%method():%-3L][%thread]: %msg%n</property>
|
||||||
|
<property name="mirai_pattern">[%-d{HH:mm:ss.SSS} %5level][%logger]: %msg%n</property>
|
||||||
|
<property name="logsDir">${sys:cgj.logsPath:-logs}</property>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<Appenders>
|
||||||
|
<Console name="STANDARD_STDOUT" target="SYSTEM_OUT">
|
||||||
|
<PatternLayout charset="${charset}">
|
||||||
|
<MarkerPatternSelector defaultPattern="${standard_pattern}">
|
||||||
|
<PatternMatch key="mirai" pattern="${mirai_pattern}" />
|
||||||
|
</MarkerPatternSelector>
|
||||||
|
</PatternLayout>
|
||||||
|
<Filters>
|
||||||
|
<LevelRangeFilter minLevel="INFO" maxLevel="INFO" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
|
</Filters>
|
||||||
|
</Console>
|
||||||
|
<Console name="STANDARD_STDERR" target="SYSTEM_ERR">
|
||||||
|
<PatternLayout charset="${charset}">
|
||||||
|
<MarkerPatternSelector defaultPattern="${standard_pattern}">
|
||||||
|
<PatternMatch key="mirai" pattern="${mirai_pattern}" />
|
||||||
|
</MarkerPatternSelector>
|
||||||
|
</PatternLayout>
|
||||||
|
<Filters>
|
||||||
|
<ThresholdFilter level="WARN" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
|
</Filters>
|
||||||
|
</Console>
|
||||||
|
|
||||||
|
<RollingFile name="rollingFile" fileName="${logsDir}/latest.log" filePattern="${logsDir}/running.%-d{yyyy-MM-dd_HH-mm-ss}.log.gz">
|
||||||
|
<Filters>
|
||||||
|
<ThresholdFilter level="DEBUG" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||||
|
</Filters>
|
||||||
|
<PatternLayout charset="${charset}">
|
||||||
|
<MarkerPatternSelector defaultPattern="${standard_pattern}">
|
||||||
|
<PatternMatch key="mirai" pattern="${mirai_pattern}" />
|
||||||
|
</MarkerPatternSelector>
|
||||||
|
</PatternLayout>
|
||||||
|
<Policies>
|
||||||
|
<OnStartupTriggeringPolicy />
|
||||||
|
</Policies>
|
||||||
|
</RollingFile>
|
||||||
|
</Appenders>
|
||||||
|
|
||||||
|
<Loggers>
|
||||||
|
<Logger level="INFO" name="org.apache.http"/>
|
||||||
|
<Root level="DEBUG">
|
||||||
|
<AppenderRef ref="STANDARD_STDOUT"/>
|
||||||
|
<AppenderRef ref="STANDARD_STDERR"/>
|
||||||
|
<AppenderRef ref="rollingFile"/>
|
||||||
|
</Root>
|
||||||
|
</Loggers>
|
||||||
|
</configuration>
|
Loading…
Reference in New Issue
Block a user