Commit 48cf30aa6f78d18e3a4ca5851b2ae5c21d63e4d6
1 parent
ac8823a6
Exists in
master
and in
2 other branches
1.remove log print
Showing
3 changed files
with
2 additions
and
76 deletions
Show diff stats
build.gradle
| @@ -51,7 +51,7 @@ uploadArchives { | @@ -51,7 +51,7 @@ uploadArchives { | ||
| 51 | authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD) | 51 | authentication(userName: NEXUS_USERNAME, password: NEXUS_PASSWORD) |
| 52 | } | 52 | } |
| 53 | pom.project { | 53 | pom.project { |
| 54 | - version '2.0.2' | 54 | + version '2.0.3' |
| 55 | artifactId ARTIFACT_Id | 55 | artifactId ARTIFACT_Id |
| 56 | groupId GROUP_ID | 56 | groupId GROUP_ID |
| 57 | packaging TYPE | 57 | packaging TYPE |
src/main/java/com/taover/repository/CustomJdbcTemplate.java
| @@ -517,7 +517,7 @@ public class CustomJdbcTemplate<T, ID extends Serializable> { | @@ -517,7 +517,7 @@ public class CustomJdbcTemplate<T, ID extends Serializable> { | ||
| 517 | beanField.setAccessible(true); | 517 | beanField.setAccessible(true); |
| 518 | beanFieldValue = beanField.get(entity); | 518 | beanFieldValue = beanField.get(entity); |
| 519 | } catch (Exception e) { | 519 | } catch (Exception e) { |
| 520 | - UtilsLog.errorForException(e, this.getClass()); | 520 | + e.printStackTrace(); |
| 521 | } | 521 | } |
| 522 | result.add(deleteEntityByID((ID)beanFieldValue)); | 522 | result.add(deleteEntityByID((ID)beanFieldValue)); |
| 523 | } | 523 | } |
src/main/java/com/taover/repository/UtilsLog.java
| @@ -1,74 +0,0 @@ | @@ -1,74 +0,0 @@ | ||
| 1 | -package com.taover.repository; | ||
| 2 | - | ||
| 3 | -import java.io.PrintWriter; | ||
| 4 | -import java.io.StringWriter; | ||
| 5 | -import java.util.HashMap; | ||
| 6 | -import java.util.Map; | ||
| 7 | - | ||
| 8 | -import org.apache.commons.logging.Log; | ||
| 9 | -import org.apache.commons.logging.LogFactory; | ||
| 10 | - | ||
| 11 | - | ||
| 12 | -public class UtilsLog { | ||
| 13 | - private static Map<String, Log> logByClassName = new HashMap<String, Log>(); | ||
| 14 | - | ||
| 15 | - /** | ||
| 16 | - * 输出日志文本 | ||
| 17 | - * @param message | ||
| 18 | - * @param infoClass | ||
| 19 | - */ | ||
| 20 | - public static void infoForMessage(String message, Class infoClass){ | ||
| 21 | - String className = infoClass.getName(); | ||
| 22 | - Log log = logByClassName.get(infoClass.getName()); | ||
| 23 | - if(log == null){ | ||
| 24 | - log = LogFactory.getLog(infoClass); | ||
| 25 | - if(log == null){ | ||
| 26 | - return; | ||
| 27 | - } | ||
| 28 | - logByClassName.put(className, log); | ||
| 29 | - } | ||
| 30 | - log.info(message); | ||
| 31 | - } | ||
| 32 | - | ||
| 33 | - /** | ||
| 34 | - * 输出日志Exception内容 | ||
| 35 | - * @param e | ||
| 36 | - * @param infoClass | ||
| 37 | - */ | ||
| 38 | - public static String infoForException(Exception e, Class infoClass){ | ||
| 39 | - StringWriter sw = new StringWriter(); | ||
| 40 | - e.printStackTrace(new PrintWriter(sw)); | ||
| 41 | - UtilsLog.infoForMessage(sw.toString(), infoClass); | ||
| 42 | - return sw.toString(); | ||
| 43 | - } | ||
| 44 | - | ||
| 45 | - /** | ||
| 46 | - * 输出文本内容 | ||
| 47 | - * @param message | ||
| 48 | - * @param infoClass | ||
| 49 | - */ | ||
| 50 | - public static void errorForMessage(String message, Class infoClass){ | ||
| 51 | - String className = infoClass.getName(); | ||
| 52 | - Log log = logByClassName.get(infoClass.getName()); | ||
| 53 | - if(log == null){ | ||
| 54 | - log = LogFactory.getLog(infoClass); | ||
| 55 | - if(log == null){ | ||
| 56 | - return; | ||
| 57 | - } | ||
| 58 | - logByClassName.put(className, log); | ||
| 59 | - } | ||
| 60 | - log.error(message); | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - /** | ||
| 64 | - * 输出日志Exception信息 | ||
| 65 | - * @param e | ||
| 66 | - * @param infoClass | ||
| 67 | - */ | ||
| 68 | - public static String errorForException(Exception e, Class infoClass){ | ||
| 69 | - StringWriter sw = new StringWriter(); | ||
| 70 | - e.printStackTrace(new PrintWriter(sw)); | ||
| 71 | - UtilsLog.errorForMessage(sw.toString(), infoClass); | ||
| 72 | - return sw.toString(); | ||
| 73 | - } | ||
| 74 | -} |