feat: 2.6.0

1. 修复日志打印参数错误问题
This commit is contained in:
byteblogs168 2024-01-15 09:23:08 +08:00
parent f75271c0fe
commit ad2dc0a442
11 changed files with 96 additions and 59 deletions

View File

@ -32,8 +32,17 @@ public class SpringContext implements ApplicationContextAware {
public static synchronized <T> T getBean(String name) {
try {
return (T) CONTEXT.getBean(name);
} catch (BeansException var2) {
log.error(" BeanName:{} not existException => {}", name, var2.getMessage());
} catch (BeansException | NullPointerException exception) {
log.error(" BeanName:{} not existException => {}", name, exception.getMessage());
return null;
}
}
public static synchronized <T> T getBean(Class<T> requiredType) {
try {
return CONTEXT.getBean(requiredType);
} catch (BeansException | NullPointerException exception) {
log.error(" BeanName:{} not existException => {}", requiredType.getName(), exception.getMessage());
return null;
}
}
@ -41,8 +50,8 @@ public class SpringContext implements ApplicationContextAware {
public static synchronized <T> T getBean(String name, Class<T> requiredType) {
try {
return CONTEXT.getBean(name, requiredType);
} catch (BeansException | NullPointerException var3) {
log.error(" BeanName:{} not existException => {}", name, var3.getMessage());
} catch (BeansException | NullPointerException exception) {
log.error(" BeanName:{} not existException => {}", name, exception.getMessage());
return null;
}
}

View File

@ -3,6 +3,8 @@ package com.aizuda.easy.retry.common.core.util;
import com.aizuda.easy.retry.common.core.context.SpringContext;
import org.springframework.core.env.Environment;
import java.util.Objects;
/**
* 获取环境信息
*
@ -10,8 +12,6 @@ import org.springframework.core.env.Environment;
* @date : 2021-12-01 14:27
*/
public class EnvironmentUtils {
private static final Environment environment = SpringContext.CONTEXT.getBean(Environment.class);
public static final String DEFAULT_ENV = "default ";
/**
@ -21,10 +21,14 @@ public class EnvironmentUtils {
*/
public static Boolean getLogStatus() {
Environment environment = SpringContext.CONTEXT.getBean(Environment.class);
Environment environment = SpringContext.getBean(Environment.class);
if (Objects.nonNull(environment)) {
return environment.getProperty("easy.retry.log.status", Boolean.class, Boolean.TRUE);
}
return Boolean.TRUE;
}
/**
* 获取环境
*
@ -32,6 +36,11 @@ public class EnvironmentUtils {
*/
public static String getActiveProfile() {
Environment environment = SpringContext.getBean(Environment.class);
if (Objects.isNull(environment)) {
return DEFAULT_ENV;
}
String[] activeProfiles = environment.getActiveProfiles();
if (activeProfiles.length == 0) {
return DEFAULT_ENV;
@ -39,7 +48,7 @@ public class EnvironmentUtils {
StringBuilder envs = new StringBuilder();
for (String activeProfile : activeProfiles) {
envs.append(activeProfile + " ");
envs.append(activeProfile).append(" ");
}
return envs.toString();
}

View File

@ -1,6 +1,5 @@
package com.aizuda.easy.retry.common.log;
import cn.hutool.core.util.StrUtil;
import com.aizuda.easy.retry.common.core.util.EnvironmentUtils;
import com.aizuda.easy.retry.common.log.lang.LogCaller;
import com.aizuda.easy.retry.common.log.level.Level;
@ -63,7 +62,7 @@ public final class Local {
return;
}
debug(LogFactory.get(LogCaller.getCallerCaller()), format, false, arguments);
debug(LogFactory.get(LogCaller.getCallerCaller()), format, arguments);
}
/**
@ -127,7 +126,7 @@ public final class Local {
return;
}
warn(LogFactory.get(LogCaller.getCallerCaller()), format, false, arguments);
warn(LogFactory.get(LogCaller.getCallerCaller()), format, arguments);
}
/**
@ -143,7 +142,7 @@ public final class Local {
return;
}
warn(LogFactory.get(LogCaller.getCallerCaller()), e, StrUtil.format(format, arguments), false);
warn(LogFactory.get(LogCaller.getCallerCaller()), e, format, arguments);
}
/**
@ -235,7 +234,7 @@ public final class Local {
return;
}
error(log, e, e.getMessage(), false);
error(log, e, e.getMessage());
}
/**

View File

@ -127,7 +127,7 @@ public final class Remote {
return;
}
warn(com.aizuda.easy.retry.common.log.LogFactory.get(LogCaller.getCallerCaller()), format, arguments);
warn(LogFactory.get(LogCaller.getCallerCaller()), format, arguments);
}
/**
@ -143,7 +143,7 @@ public final class Remote {
return;
}
warn(com.aizuda.easy.retry.common.log.LogFactory.get(LogCaller.getCallerCaller()), e, StrUtil.format(format, arguments));
warn(LogFactory.get(LogCaller.getCallerCaller()), e, StrUtil.format(format, arguments));
}
/**
@ -205,7 +205,7 @@ public final class Remote {
return;
}
error(com.aizuda.easy.retry.common.log.LogFactory.get(LogCaller.getCallerCaller()), format, arguments);
error(LogFactory.get(LogCaller.getCallerCaller()), format, arguments);
}
/**
@ -221,7 +221,7 @@ public final class Remote {
return;
}
error(com.aizuda.easy.retry.common.log.LogFactory.get(LogCaller.getCallerCaller()), e, format, arguments);
error(LogFactory.get(LogCaller.getCallerCaller()), e, format, arguments);
}
/**
@ -245,7 +245,7 @@ public final class Remote {
* @param format 格式文本{} 代表变量
* @param arguments 变量对应的参数
*/
public void error(com.aizuda.easy.retry.common.log.Log log, String format, Object... arguments) {
public void error(Log log, String format, Object... arguments) {
if (!EnvironmentUtils.getLogStatus()) {
return;
}
@ -261,7 +261,7 @@ public final class Remote {
* @param format 格式文本{} 代表变量
* @param arguments 变量对应的参数
*/
public void error(com.aizuda.easy.retry.common.log.Log log, Throwable e, String format, Object... arguments) {
public void error(Log log, Throwable e, String format, Object... arguments) {
if (!EnvironmentUtils.getLogStatus()) {
return;
}
@ -284,6 +284,6 @@ public final class Remote {
return;
}
com.aizuda.easy.retry.common.log.LogFactory.get(LogCaller.getCallerCaller()).log(FQCN, level, t, format, true, arguments);
LogFactory.get(LogCaller.getCallerCaller()).log(FQCN, level, t, format, true, arguments);
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,8 +5,8 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Easy Retry</title>
<script type="module" crossorigin src="./assets/dNTD4Vxf.js"></script>
<link rel="stylesheet" crossorigin href="./assets/ZUK1tnHV.css">
<script type="module" crossorigin src="./assets/eCMYxQqR.js"></script>
<link rel="stylesheet" crossorigin href="./assets/tWxQPn1H.css">
</head>
<body>

View File

@ -222,6 +222,13 @@ export const asyncRouterMap = [
component: () => import('@/views/job/WorkflowEdit'),
meta: { title: '工作流编辑', icon: 'profile', permission: ['jobBatch'] }
},
{
path: '/job/workflow/copy',
name: 'WorkflowCopy',
hidden: true,
component: () => import('@/views/job/WorkflowCopy'),
meta: { title: '工作流复制', icon: 'profile', permission: ['jobBatch'] }
},
{
path: '/job/workflow/detail',
name: 'WorkflowDetail',

View File

@ -0,0 +1,12 @@
<template>
<work-flow value="wA4wN1nZ" />
</template>
<script>
import WorkFlow from './form/WorkFlow.vue'
export default {
name: 'WorkFlowEdit',
components: { WorkFlow }
}
</script>

View File

@ -313,6 +313,7 @@ export default {
})
},
handleCopy (record) {
this.$router.push({ path: '/job/workflow/copy', query: { id: record.id } })
},
handleDel (record) {
delWorkflow(record.id).then((res) => {