feat: add if statement in sync workflow

pull/74/head
yanglbme 4 years ago
parent 3684c79065
commit be0cc417f6

@ -7,6 +7,7 @@ on:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.repository == 'doocs/source-code-hunter'
steps: steps:
- name: Sync to Gitee - name: Sync to Gitee
uses: wearerequired/git-mirror-action@master uses: wearerequired/git-mirror-action@master

@ -21,7 +21,7 @@ public enum LogLevel {
![image-20200323144523848](../../images/SpringBoot/image-20200323144523848.png) ![image-20200323144523848](../../images/SpringBoot/image-20200323144523848.png)
```JAVA ```java
static { static {
// KEY : springBoot 定义的日志级别, value: jdk 定义的日志级别 // KEY : springBoot 定义的日志级别, value: jdk 定义的日志级别
LEVELS.map(LogLevel.TRACE, Level.FINEST); LEVELS.map(LogLevel.TRACE, Level.FINEST);
@ -58,7 +58,7 @@ public enum LogLevel {
- 一个 map 对象: `SYSTEMS` - 一个 map 对象: `SYSTEMS`
```JAVA ```java
/** /**
* key: 第三方日志框架的类 value: springBoot 中的处理类 * key: 第三方日志框架的类 value: springBoot 中的处理类
*/ */
@ -145,7 +145,7 @@ public static LoggingSystem get(ClassLoader classLoader) {
- 因为前文中我们已知对象是:`org.springframework.boot.logging.logback.LogbackLoggingSystem` 直接看这个类的**`beforeInitialize`**方法 - 因为前文中我们已知对象是:`org.springframework.boot.logging.logback.LogbackLoggingSystem` 直接看这个类的**`beforeInitialize`**方法
```JAVA ```java
@Override @Override
public void beforeInitialize() { public void beforeInitialize() {
// 日志上下文 // 日志上下文
@ -168,7 +168,7 @@ public static LoggingSystem get(ClassLoader classLoader) {
- `org.springframework.boot.context.logging.LoggingApplicationListener#onApplicationEnvironmentPreparedEvent` - `org.springframework.boot.context.logging.LoggingApplicationListener#onApplicationEnvironmentPreparedEvent`
```JAVA ```java
private void onApplicationEnvironmentPreparedEvent(ApplicationEnvironmentPreparedEvent event) { private void onApplicationEnvironmentPreparedEvent(ApplicationEnvironmentPreparedEvent event) {
if (this.loggingSystem == null) { if (this.loggingSystem == null) {
this.loggingSystem = LoggingSystem.get(event.getSpringApplication().getClassLoader()); this.loggingSystem = LoggingSystem.get(event.getSpringApplication().getClassLoader());
@ -180,7 +180,7 @@ public static LoggingSystem get(ClassLoader classLoader) {
- `org.springframework.boot.context.logging.LoggingApplicationListener#initializeSystem` - `org.springframework.boot.context.logging.LoggingApplicationListener#initializeSystem`
```JAVA ```java
protected void initialize(ConfigurableEnvironment environment, ClassLoader classLoader) { protected void initialize(ConfigurableEnvironment environment, ClassLoader classLoader) {
new LoggingSystemProperties(environment).apply(); new LoggingSystemProperties(environment).apply();
this.logFile = LogFile.get(environment); this.logFile = LogFile.get(environment);
@ -199,7 +199,7 @@ public static LoggingSystem get(ClassLoader classLoader) {
``` ```
```JAVA ```java
private void initializeSystem(ConfigurableEnvironment environment, LoggingSystem system, LogFile logFile) { private void initializeSystem(ConfigurableEnvironment environment, LoggingSystem system, LogFile logFile) {
LoggingInitializationContext initializationContext = new LoggingInitializationContext(environment); LoggingInitializationContext initializationContext = new LoggingInitializationContext(environment);
String logConfig = environment.getProperty(CONFIG_PROPERTY); String logConfig = environment.getProperty(CONFIG_PROPERTY);
@ -246,7 +246,7 @@ public static LoggingSystem get(ClassLoader classLoader) {
- `org.springframework.boot.logging.AbstractLoggingSystem#initializeWithConventions` - `org.springframework.boot.logging.AbstractLoggingSystem#initializeWithConventions`
```JAVA ```java
private void initializeWithConventions(LoggingInitializationContext initializationContext, LogFile logFile) { private void initializeWithConventions(LoggingInitializationContext initializationContext, LogFile logFile) {
String config = getSelfInitializationConfig(); String config = getSelfInitializationConfig();
if (config != null && logFile == null) { if (config != null && logFile == null) {
@ -269,7 +269,7 @@ public static LoggingSystem get(ClassLoader classLoader) {
- `org.springframework.boot.logging.logback.LogbackLoggingSystem#loadDefaults` - `org.springframework.boot.logging.logback.LogbackLoggingSystem#loadDefaults`
```JAVA ```java
@Override @Override
protected void loadDefaults(LoggingInitializationContext initializationContext, LogFile logFile) { protected void loadDefaults(LoggingInitializationContext initializationContext, LogFile logFile) {
LoggerContext context = getLoggerContext(); LoggerContext context = getLoggerContext();
@ -293,7 +293,7 @@ public static LoggingSystem get(ClassLoader classLoader) {
``` ```
```JAVA ```java
@Override @Override
public void initialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile) { public void initialize(LoggingInitializationContext initializationContext, String configLocation, LogFile logFile) {
LoggerContext loggerContext = getLoggerContext(); LoggerContext loggerContext = getLoggerContext();
@ -316,7 +316,7 @@ public static LoggingSystem get(ClassLoader classLoader) {
标记`markAsInitialized` 标记`markAsInitialized`
```JAVA ```java
private void markAsInitialized(LoggerContext loggerContext) { private void markAsInitialized(LoggerContext loggerContext) {
loggerContext.putObject(LoggingSystem.class.getName(), new Object()); loggerContext.putObject(LoggingSystem.class.getName(), new Object());
} }
@ -358,7 +358,7 @@ public static LoggingSystem get(ClassLoader classLoader) {
- 此时配置文件地址出现了 - 此时配置文件地址出现了
```JAVA ```java
protected String getSelfInitializationConfig() { protected String getSelfInitializationConfig() {
// 寻找配置文件 // 寻找配置文件
return findConfig(getStandardConfigLocations()); return findConfig(getStandardConfigLocations());
@ -366,7 +366,7 @@ public static LoggingSystem get(ClassLoader classLoader) {
``` ```
```JAVA ```java
@Override @Override
protected String[] getStandardConfigLocations() { protected String[] getStandardConfigLocations() {
return new String[] { "logback-test.groovy", "logback-test.xml", "logback.groovy", "logback.xml" }; return new String[] { "logback-test.groovy", "logback-test.xml", "logback.groovy", "logback.xml" };
@ -374,7 +374,7 @@ public static LoggingSystem get(ClassLoader classLoader) {
``` ```
```JAVA ```java
private String findConfig(String[] locations) { private String findConfig(String[] locations) {
for (String location : locations) { for (String location : locations) {
ClassPathResource resource = new ClassPathResource(location, this.classLoader); ClassPathResource resource = new ClassPathResource(location, this.classLoader);
@ -391,7 +391,7 @@ public static LoggingSystem get(ClassLoader classLoader) {
#### reinitialize #### reinitialize
```JAVA ```java
@Override @Override
protected void reinitialize(LoggingInitializationContext initializationContext) { protected void reinitialize(LoggingInitializationContext initializationContext) {
// 日志上下文重新设置 // 日志上下文重新设置
@ -403,7 +403,7 @@ public static LoggingSystem get(ClassLoader classLoader) {
``` ```
```JAVA ```java
@Override @Override
protected void loadConfiguration(LoggingInitializationContext initializationContext, String location, protected void loadConfiguration(LoggingInitializationContext initializationContext, String location,
LogFile logFile) { LogFile logFile) {

Loading…
Cancel
Save