From 0841924b13ae40f1b60ab1550ac693b095fe6a89 Mon Sep 17 00:00:00 2001 From: LamGC Date: Tue, 6 Oct 2020 10:33:13 +0800 Subject: [PATCH] =?UTF-8?q?[Add]=20Exec=20=E6=B7=BB=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E9=A2=84=E6=9C=9F(=3F)=E7=9A=84=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E6=A8=A1=E5=9D=97;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Add] ApplicationMain 程序主入口, 负责初始化项目运行环境和启动项目; [Add] log4j2.xml 使用上一版日志配置, 后续会有调整; [Add] cgj_setting.json 初始配置文件, 需等 Core 模块完成后才会具体编写; --- .../java/net/lamgc/cgj/ApplicationMain.java | 49 +++++++++++++++ .../resources/default_config/cgj_setting.json | 3 + .../src/main/resources/log4j2.xml | 59 +++++++++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 ContentGrabbingJi-exec/src/main/java/net/lamgc/cgj/ApplicationMain.java create mode 100644 ContentGrabbingJi-exec/src/main/resources/default_config/cgj_setting.json create mode 100644 ContentGrabbingJi-exec/src/main/resources/log4j2.xml diff --git a/ContentGrabbingJi-exec/src/main/java/net/lamgc/cgj/ApplicationMain.java b/ContentGrabbingJi-exec/src/main/java/net/lamgc/cgj/ApplicationMain.java new file mode 100644 index 0000000..d4e1add --- /dev/null +++ b/ContentGrabbingJi-exec/src/main/java/net/lamgc/cgj/ApplicationMain.java @@ -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 . + */ + +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() {} + +} diff --git a/ContentGrabbingJi-exec/src/main/resources/default_config/cgj_setting.json b/ContentGrabbingJi-exec/src/main/resources/default_config/cgj_setting.json new file mode 100644 index 0000000..0e0dcd2 --- /dev/null +++ b/ContentGrabbingJi-exec/src/main/resources/default_config/cgj_setting.json @@ -0,0 +1,3 @@ +{ + +} \ No newline at end of file diff --git a/ContentGrabbingJi-exec/src/main/resources/log4j2.xml b/ContentGrabbingJi-exec/src/main/resources/log4j2.xml new file mode 100644 index 0000000..757aec8 --- /dev/null +++ b/ContentGrabbingJi-exec/src/main/resources/log4j2.xml @@ -0,0 +1,59 @@ + + + + + ./logs + UTF-8 + [%-d{HH:mm:ss.SSS} %5level][%logger.%method():%-3L][%thread]: %msg%n + [%-d{HH:mm:ss.SSS} %5level][%logger]: %msg%n + ${sys:cgj.logsPath:-logs} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file