mirror of
				https://github.com/LamGC/Oracle-Sentry.git
				synced 2025-11-04 10:36:58 +00:00 
			
		
		
		
	refactor(logging): 移除 log4j 配置文件, 改用 logback 配置文件, 修正 application 配置默认值.
移除未使用的 log4j 配置文件, 沿用 SpringBoot 默认日志实现 logback, 添加对应的日志配置文件, 同时修正 application.yml 的各项配置为默认值, 以防误导用户.
This commit is contained in:
		@ -1,10 +1,8 @@
 | 
			
		||||
oracle:
 | 
			
		||||
  identity:
 | 
			
		||||
    # location: "C:\\Users\\80728\\.oci\\global\\"
 | 
			
		||||
    pattern: '.+\.oracle\.ini$'
 | 
			
		||||
    location: "./identity/"
 | 
			
		||||
  script:
 | 
			
		||||
    location: "./scripts/"
 | 
			
		||||
    ssh:
 | 
			
		||||
      identityPath: "./ssh.config.json"
 | 
			
		||||
 | 
			
		||||
logging:
 | 
			
		||||
  level:
 | 
			
		||||
    root: INFO
 | 
			
		||||
      identityPath: "./config/ssh.config.json"
 | 
			
		||||
 | 
			
		||||
@ -1,75 +0,0 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<!--
 | 
			
		||||
  ~ Copyright (C) 2021  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.
 | 
			
		||||
  ~
 | 
			
		||||
  ~ 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/>.
 | 
			
		||||
  -->
 | 
			
		||||
 | 
			
		||||
<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>
 | 
			
		||||
        <Root level="DEBUG">
 | 
			
		||||
            <AppenderRef ref="STANDARD_STDOUT"/>
 | 
			
		||||
            <AppenderRef ref="STANDARD_STDERR"/>
 | 
			
		||||
            <AppenderRef ref="rollingFile"/>
 | 
			
		||||
        </Root>
 | 
			
		||||
    </Loggers>
 | 
			
		||||
</configuration>
 | 
			
		||||
							
								
								
									
										47
									
								
								src/main/resources/logback.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								src/main/resources/logback.xml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,47 @@
 | 
			
		||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
			
		||||
<configuration debug="false">
 | 
			
		||||
    <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
 | 
			
		||||
        <target>System.out</target>
 | 
			
		||||
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
 | 
			
		||||
            <level>INFO</level>
 | 
			
		||||
            <onMatch>ACCEPT</onMatch>
 | 
			
		||||
            <onMismatch>DENY</onMismatch>
 | 
			
		||||
        </filter>
 | 
			
		||||
        <encoder>
 | 
			
		||||
            <pattern>[%d{HH:mm:ss.SSS} %5level][%logger][%thread]: %msg%n</pattern>
 | 
			
		||||
        </encoder>
 | 
			
		||||
    </appender>
 | 
			
		||||
    <appender name="stderr" class="ch.qos.logback.core.ConsoleAppender">
 | 
			
		||||
        <target>System.err</target>
 | 
			
		||||
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
 | 
			
		||||
            <level>WARN</level>
 | 
			
		||||
        </filter>
 | 
			
		||||
        <encoder>
 | 
			
		||||
            <pattern>[%d{HH:mm:ss.SSS} %5level][%logger][%thread]: %msg%n</pattern>
 | 
			
		||||
        </encoder>
 | 
			
		||||
    </appender>
 | 
			
		||||
 | 
			
		||||
    <appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
 | 
			
		||||
        <file>./logs/latest.log</file>
 | 
			
		||||
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
 | 
			
		||||
            <level>TRACE</level>
 | 
			
		||||
            <onMatch>DENY</onMatch>
 | 
			
		||||
            <onMismatch>ACCEPT</onMismatch>
 | 
			
		||||
        </filter>
 | 
			
		||||
        <encoder>
 | 
			
		||||
            <pattern>[%d{HH:mm:ss.SSS} %5level][%logger][%thread]: %msg%n</pattern>
 | 
			
		||||
        </encoder>
 | 
			
		||||
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
 | 
			
		||||
            <fileNamePattern>./logs/run-%d{yyyy-MM-dd}.log</fileNamePattern>
 | 
			
		||||
            <maxHistory>30</maxHistory>
 | 
			
		||||
        </rollingPolicy>
 | 
			
		||||
    </appender>
 | 
			
		||||
 | 
			
		||||
    <logger name="com.oracle.bmc" level="WARN"/>
 | 
			
		||||
    <logger name="com.oracle.bmc.http.ApacheConfigurator" level="ERROR"/>
 | 
			
		||||
    <root>
 | 
			
		||||
        <appender-ref ref="stdout" />
 | 
			
		||||
        <appender-ref ref="stderr" />
 | 
			
		||||
        <appender-ref ref="logFile" />
 | 
			
		||||
    </root>
 | 
			
		||||
</configuration>
 | 
			
		||||
		Reference in New Issue
	
	Block a user