From 5310c6b588aac291f9f82b5e8457e7697782ade1 Mon Sep 17 00:00:00 2001 From: pcm Date: Fri, 22 Nov 2024 17:34:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Elog=E8=84=B1=E6=95=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- springboot-log/pom.xml | 5 ++++ .../com/pancm/{Application.java => App.java} | 6 ++--- .../pancm/config/DemoDefenderStrategy.java | 24 ------------------- .../main/java/com/pancm/config/PluginOne.java | 17 ------------- .../pancm/enums/SimpleDefenderStrategy.java | 24 ------------------- .../pancm/service/impl/BaseServiceImpl.java | 1 + 6 files changed, 9 insertions(+), 68 deletions(-) rename springboot-log/src/main/java/com/pancm/{Application.java => App.java} (90%) delete mode 100644 springboot-log/src/main/java/com/pancm/config/DemoDefenderStrategy.java delete mode 100644 springboot-log/src/main/java/com/pancm/config/PluginOne.java delete mode 100644 springboot-log/src/main/java/com/pancm/enums/SimpleDefenderStrategy.java diff --git a/springboot-log/pom.xml b/springboot-log/pom.xml index be8f940..c05fffa 100644 --- a/springboot-log/pom.xml +++ b/springboot-log/pom.xml @@ -218,11 +218,15 @@ springboot-log + compile + src org.springframework.boot spring-boot-maven-plugin + true + com.pancm.App org.projectlombok @@ -234,4 +238,5 @@ + diff --git a/springboot-log/src/main/java/com/pancm/Application.java b/springboot-log/src/main/java/com/pancm/App.java similarity index 90% rename from springboot-log/src/main/java/com/pancm/Application.java rename to springboot-log/src/main/java/com/pancm/App.java index 413880d..b5aa2f0 100644 --- a/springboot-log/src/main/java/com/pancm/Application.java +++ b/springboot-log/src/main/java/com/pancm/App.java @@ -21,16 +21,16 @@ @ServletComponentScan @SpringBootApplication @Slf4j -public class Application { +public class App { public static void main(String[] args) throws UnknownHostException { - ConfigurableApplicationContext application = SpringApplication.run(Application.class, args); + ConfigurableApplicationContext application = SpringApplication.run(App.class, args); Environment env = application.getEnvironment(); String ip = InetAddress.getLocalHost().getHostAddress(); String port = env.getProperty("server.port"); String path = env.getProperty("server.servlet.context-path"); log.info("\n----------------------------------------------------------\n\t" + - "Application springboot-demo is running! Access URLs:\n\t" + + "Application springboot-log is running! Access URLs:\n\t" + "Local: \t\thttp://localhost:" + port + path + "/\n\t" + "External: \thttp://" + ip + ":" + port + path + "/\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + diff --git a/springboot-log/src/main/java/com/pancm/config/DemoDefenderStrategy.java b/springboot-log/src/main/java/com/pancm/config/DemoDefenderStrategy.java deleted file mode 100644 index f8dc36b..0000000 --- a/springboot-log/src/main/java/com/pancm/config/DemoDefenderStrategy.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.pancm.config; - -@Component("demoDefenderStrategy") -public class DemoDefenderStrategy implements DefenderStrategy{ - @Override - public String category() { - return "name"; - } - - @Override - public int retainPrefixCount() { - return 1; - } - - @Override - public int retainSuffixCount() { - return 1; - } - - @Override - public char replaceChar() { - return '$'; - } -} \ No newline at end of file diff --git a/springboot-log/src/main/java/com/pancm/config/PluginOne.java b/springboot-log/src/main/java/com/pancm/config/PluginOne.java deleted file mode 100644 index 2530c79..0000000 --- a/springboot-log/src/main/java/com/pancm/config/PluginOne.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.pancm.config; - -@Component - public class PluginOne implements LogbackMessageDefender { - - public static final String HANDLE_BY_PLUGIN = "PluginOneAbc"; - - @Override - public boolean support(ILoggingEvent event) { - return event.getMDCPropertyMap().containsKey(HANDLE_BY_PLUGIN); - } - - @Override - public void desensitize(ILoggingEvent event, String message, StringBuilder buffer) { - buffer.append("[O_O] ").append(event.getFormattedMessage()).append(" [O_O]"); - } - } \ No newline at end of file diff --git a/springboot-log/src/main/java/com/pancm/enums/SimpleDefenderStrategy.java b/springboot-log/src/main/java/com/pancm/enums/SimpleDefenderStrategy.java deleted file mode 100644 index a92ad22..0000000 --- a/springboot-log/src/main/java/com/pancm/enums/SimpleDefenderStrategy.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.pancm.enums; - -public enum SimpleDefenderStrategy implements DefenderStrategy { - - /** 姓名类脱敏策略 */ - NAME("name", 1, 1, '*'), - - /** 账号类脱敏策略 */ - ACCOUNT_NO("accountNo", 2, 2, '*'), - - /** 邮箱类脱敏策略 */ - EMAIL("email", 2, 7, '*'), - - /** 身份证号类脱敏策略 */ - ID_CARD("idCard", 6, 4, '*'), - - /** 手机号码类脱敏策略 */ - PHONE_NUMBER("phoneNumber", 3, 4, '*'), - - /** 住址类脱敏策略 */ - ADDRESS("address", 3, 4, '*'); - - // 省略... -} \ No newline at end of file diff --git a/springboot-summarizing/src/main/java/com/pancm/service/impl/BaseServiceImpl.java b/springboot-summarizing/src/main/java/com/pancm/service/impl/BaseServiceImpl.java index 6f29d08..6f4d03c 100644 --- a/springboot-summarizing/src/main/java/com/pancm/service/impl/BaseServiceImpl.java +++ b/springboot-summarizing/src/main/java/com/pancm/service/impl/BaseServiceImpl.java @@ -45,6 +45,7 @@ public boolean update(T entity){ falg=true; } catch (Exception e) { logger.error("更新"+entity+"失败!原因是:",e); + } return falg; }