From 8e76caf1372f18dc724da6c228e28af5beaef82f Mon Sep 17 00:00:00 2001 From: yiyan Date: Fri, 30 Mar 2018 15:13:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=B5=8B=E8=AF=95=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=BA=94=E7=94=A8=E7=AB=AF=E5=8F=A3=E3=80=81logback?= =?UTF-8?q?=E6=8D=A2=E4=B8=BAlog4j?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 16 +------- .../java/com/ifish/action/AdInfoAction.java | 4 ++ src/main/resources/jdbc.properties | 5 ++- src/main/resources/log4j.properties | 41 +++++++++++++++++++ .../{logback.xml => logback.xml_bak} | 2 +- src/main/resources/property.properties | 1 + src/main/resources/spring-mybatis.xml | 3 -- src/main/webapp/WEB-INF/view/htm/taglib.jsp | 4 +- 8 files changed, 54 insertions(+), 22 deletions(-) create mode 100755 src/main/resources/log4j.properties rename src/main/resources/{logback.xml => logback.xml_bak} (97%) diff --git a/pom.xml b/pom.xml index 5743e63..8e98c2e 100644 --- a/pom.xml +++ b/pom.xml @@ -81,20 +81,8 @@ org.slf4j - slf4j-api - 1.7.12 - - - - ch.qos.logback - logback-core - 1.1.2 - - - - ch.qos.logback - logback-classic - 1.1.2 + slf4j-log4j12 + 1.7.13 diff --git a/src/main/java/com/ifish/action/AdInfoAction.java b/src/main/java/com/ifish/action/AdInfoAction.java index e56297d..4de1da7 100644 --- a/src/main/java/com/ifish/action/AdInfoAction.java +++ b/src/main/java/com/ifish/action/AdInfoAction.java @@ -1,6 +1,7 @@ package com.ifish.action; import org.apache.commons.lang3.StringUtils; +import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -29,6 +30,8 @@ import com.ifishNew.help.FastDFSClientI; @Controller public class AdInfoAction { + private Logger log = Logger.getLogger(AdInfoAction.class); + @Autowired private AdInfoService adInfoService; /** @@ -87,6 +90,7 @@ public class AdInfoAction { } catch (IfishException e) { throw e; } catch (Exception e) { + log.error(this.getClass().getName(),e); throw new IfishException(SysUserEnum.warn113); } adInfo.setAdImage(newImgName); diff --git a/src/main/resources/jdbc.properties b/src/main/resources/jdbc.properties index 2b93816..b59707e 100644 --- a/src/main/resources/jdbc.properties +++ b/src/main/resources/jdbc.properties @@ -1,7 +1,8 @@ c3p0.driverClassName=com.mysql.jdbc.Driver c3p0.url=jdbc\:mysql\://localhost\:3306/myfishdb?characterEncoding\=UTF-8 -c3p0.username=ifish -c3p0.password=ifish7pwd +#c3p0.url=jdbc\:mysql\://139.196.24.156\:3306/myfishdb?characterEncoding\=UTF-8 +c3p0.username=root +c3p0.password=ifish7mysql #c3p0.username=root #c3p0.password=123456 diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties new file mode 100755 index 0000000..48cecb8 --- /dev/null +++ b/src/main/resources/log4j.properties @@ -0,0 +1,41 @@ +log4j.rootLogger=INFO,CONSOLE,FILE,ROLLING_FILE +################### +# Console Appender +################### +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.Threshold=INFO +log4j.appender.CONSOLE.Target=System.out +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=[ifish7System][%-5p]%d - (%F:%L) - %m%n + +######################## +# [INFO]Daily Rolling File +######################## +log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender +log4j.appender.FILE.Threshold=INFO +log4j.appender.FILE.File=/logs/ifishSystem/ifish7System_ALL.log +log4j.appender.FILE.Append=true +log4j.appender.FILE.ImmediateFlush = true +log4j.appender.FILE.DatePattern='.'yyyy-MM-dd +log4j.appender.FILE.layout=org.apache.log4j.PatternLayout +log4j.appender.FILE.layout.ConversionPattern=[ifish7System][%-5p]%d - %c.%t(%F:%L) - %m%n + +######################## +# [ERROR]Rolling File +######################## +log4j.appender.ROLLING_FILE=org.apache.log4j.DailyRollingFileAppender +log4j.appender.ROLLING_FILE.Threshold=ERROR +log4j.appender.ROLLING_FILE.File=/logs/ifishSystem/ifish7System_ERROR.log +log4j.appender.ROLLING_FILE.Append=true +log4j.appender.ROLLING_FILE.ImmediateFlush = true +log4j.appender.ROLLING_FILE.DatePattern='.'yyyy-MM-dd +log4j.appender.ROLLING_FILE.layout=org.apache.log4j.PatternLayout +log4j.appender.ROLLING_FILE.layout.ConversionPattern=[ifish7System][%-5p]%d - %c.%t(%F:%L) - %m%n + +log4j.logger.org.springframework=INFO +log4j.logger.com.ibatis=ERROR +log4j.logger.java.sql=INFO +log4j.logger.com.travelsky.ypb.service.persistent=ERROR +log4j.logger.com.taobao.diamond=ERROR +log4j.logger.com.umetrip.consumer=ERROR +log4j.logger.com.umetrip.register=ERROR diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml_bak similarity index 97% rename from src/main/resources/logback.xml rename to src/main/resources/logback.xml_bak index ec0165e..f60a4b9 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml_bak @@ -28,7 +28,7 @@ - + diff --git a/src/main/resources/property.properties b/src/main/resources/property.properties index f6d5185..095369e 100644 --- a/src/main/resources/property.properties +++ b/src/main/resources/property.properties @@ -27,4 +27,5 @@ fastDFS_url_local=http://139.196.24.156:83/ #FastDFS\u6587\u4ef6URL\u8bbf\u95ee\u8def\u5f84(\u6b63\u5f0f\u73af\u5883) fastDFS_url_app=http://app.ifish7.com/ #\u73af\u5883(local:\u672c\u5730\u73af\u5883,test:\u6d4b\u8bd5\u73af\u5883,\u6b63\u5f0f\u73af\u5883:product) +#env=test env=product \ No newline at end of file diff --git a/src/main/resources/spring-mybatis.xml b/src/main/resources/spring-mybatis.xml index 97b47ba..b6027e1 100644 --- a/src/main/resources/spring-mybatis.xml +++ b/src/main/resources/spring-mybatis.xml @@ -10,11 +10,8 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd - http://www.springframework.org/schema/webflow-config http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.0.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.1.xsd - http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-4.1.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-4.1.xsd - http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi-1.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd diff --git a/src/main/webapp/WEB-INF/view/htm/taglib.jsp b/src/main/webapp/WEB-INF/view/htm/taglib.jsp index 6aef6d5..fd93996 100644 --- a/src/main/webapp/WEB-INF/view/htm/taglib.jsp +++ b/src/main/webapp/WEB-INF/view/htm/taglib.jsp @@ -10,8 +10,8 @@ picturePath = request.getScheme() + "://" + request.getServerName() + ":81/"; } //测试环境 else if (IfishFileDirectory.env.equals("test")) { - basePath = "http://139.196.24.156:83/"; - picturePath = "http://139.196.24.156:83/"; + basePath = "http://139.196.24.156:8080/"; + picturePath = "http://139.196.24.156:8080/"; IMPath = "http://www.zhangxinyanv5.top/neteaseIM/im/index.html"; } //正式环境 else if (IfishFileDirectory.env.equals("product")) {