Authored by jijing

Merge branch 'dev'

# Conflicts:
#	deploy/src/main/META-INF/autoconf/auto-config.xml
#	deploy/src/main/bin/env.bat
#	deploy/src/main/bin/env.sh
#	web/src/main/webapp/META-INF/autoconf/auto-config.xml
#	web/src/main/webapp/META-INF/autoconf/databases.yml
Showing 24 changed files with 198 additions and 72 deletions
... ... @@ -5,3 +5,5 @@ classes/
.idea
*.iml
*.classpath
service/search-service.eml
web/.settings/
... ...
... ... @@ -3,9 +3,15 @@
<config>
<group>
<!--yoho-search-autoconfig-->
<<<<<<< HEAD
<property name="yoho.searchservice.env.webapphome" defaultValue="/home/test/yoho-search-service/deploy" description="应用根目录"/>
<property name="yoho.searchservice.env.serverport" defaultValue="7" description="应用端口"/>
<property name="yoho.searchservice.env.namespace" defaultValue="search-service" description="应用命名空间"/>
=======
<property name="yoho.search.service.env.webapphome" defaultValue="/home/test/yoho-search-service/deploy" description="应用根目录"/>
<property name="yoho.search.service.env.serverport" defaultValue="7" description="应用端口"/>
<property name="yoho.search.service.env.namespace" defaultValue="search-service" description="应用命名空间"/>
>>>>>>> dev
<property name="yoho.env.javahome" defaultValue="/usr/local/java" description="" />
<property name="yoho.env.productmode" defaultValue="TEST" description="" />
<property name="yoho.env.serverhome" defaultValue="/usr/local/tomcat" description="" />
... ...
set JAVA_MEM_OPT= -Xms1024m -Xmx1024m -XX:MaxPermSize=128m -Djava.net.preferIPv4Stack=true
set JAVA_HOME=${yoho.env.javahome}
set WEB_APP_HOME=${yoho.search.env.webapphome}
set WEB_APP_HOME=${yoho.search.service.env.webapphome}
#if("${yoho.env.servertype}"=="jboss")
set JBOSS_HOME=${yoho.env.serverhome}
set JBOSS_BASE_DIR=${yoho.search.env.webapphome}/jboss_server
set JBOSS_BASE_DIR=${yoho.search.service.env.webapphome}/jboss_server
set JBOSS_SERVER_BASE_DIR= -Djboss.server.base.dir=%JBOSS_BASE_DIR%
#end
#if("${yoho.env.servertype}"=="tomcat")
set CATALINA_HOME=${yoho.env.serverhome}
set CATALINA_BASE=${yoho.search.env.webapphome}/tomcat_server
set CATALINA_BASE=${yoho.search.service.env.webapphome}/tomcat_server
#end
... ...
... ... @@ -8,20 +8,20 @@ BASE_BIN_DIR=`dirname $0`
. $BASE_BIN_DIR/functions.sh
export JAVA_HOME=${yoho.env.javahome}
export WEB_APP_HOME=${yoho.searchservice.env.webapphome}
export SERVER_PORT=${yoho.searchservice.env.serverport}
export WEB_APP_HOME=${yoho.search.service.env.webapphome}
export SERVER_PORT=${yoho.search.service.env.serverport}
export PRODUCTION_MODE="${yoho.env.productmode}"
export SERVER_HOME=${yoho.env.serverhome}
export SERVER_TYPE=${yoho.env.servertype}
export SERVER_NAMESPACE=${yoho.searchservice.env.namespace}
export SERVER_NAMESPACE=${yoho.search.service.env.namespace}
export GW_URL=${Gateway_URL}
#if("${yoho.env.servertype}"=="jboss")
export SERVER_BASE_DIR=" -Djboss.server.base.dir=${yoho.searchservice.env.webapphome}/.jboss/default "
export SERVER_BASE_DIR=" -Djboss.server.base.dir=${yoho.search.service.env.webapphome}/.jboss/default "
#end
#if("${yoho.env.servertype}"=="tomcat")
export SERVER_BASE_DIR=" -Dcatalina.base=${yoho.searchservice.env.webapphome}/.tomcat "
export SERVER_BASE_DIR=" -Dcatalina.base=${yoho.search.service.env.webapphome}/.tomcat "
#end
export NAMING_PORT=`expr 9000 + $SERVER_PORT`
... ...
<?xml version="1.0" encoding="GB2312"?>
<application>
<display-name>yoho-search</display-name>
<description>yoho-search</description>
<display-name>yoho-search-service</display-name>
<description>yoho-search-service</description>
<module>
<web>
<web-uri>yoho-search.war</web-uri>
<context-root>${yoho.search.env.namespace}</context-root>
<web-uri>yoho-search-service.war</web-uri>
<context-root>${yoho.search.service.env.namespace}</context-root>
</web>
</module>
</application>
... ...
set JAVA_MEM_OPT= -Xms1024m -Xmx1024m -XX:MaxPermSize=128m -Djava.net.preferIPv4Stack=true
set JAVA_HOME=/usr/local/java
<<<<<<< HEAD
set WEB_APP_HOME=/home/master/yoho-search-service/deploy
set CATALINA_HOME=/usr/local/tomcat
set CATALINA_BASE=/home/master/yoho-search/deploy/tomcat_server
=======
set WEB_APP_HOME=/home/dev/yoho-search-service/deploy
set CATALINA_HOME=/usr/local/tomcat
set CATALINA_BASE=/home/dev/yoho-search-service/deploy/tomcat_server
>>>>>>> dev
rem set JAVA_DEBUG_OPT= -server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8082,server=y,suspend=n
... ...
<<<<<<< HEAD
#!/bin/bash
#@Authro Lijian
#@Date 2007-05-24
... ... @@ -75,3 +76,82 @@ fi
JAVA_OPTS=" $JAVA_OPTS $SERVER_BASE_DIR "
=======
#!/bin/bash
#@Authro Lijian
#@Date 2007-05-24
BASE_BIN_DIR=`dirname $0`
. $BASE_BIN_DIR/functions.sh
export JAVA_HOME=/usr/local/java
export WEB_APP_HOME=/home/dev/yoho-search-service/deploy
export SERVER_PORT=8
export PRODUCTION_MODE="TEST"
export SERVER_HOME=/usr/local/tomcat
export SERVER_TYPE=tomcat
export SERVER_NAMESPACE=search-service
export GW_URL=$Gateway_URL
export SERVER_BASE_DIR=" -Dcatalina.base=/home/dev/yoho-search-service/deploy/.tomcat "
export NAMING_PORT=`expr 9000 + $SERVER_PORT`
export HTTP_SERVER_PORT=`expr 8080 + $SERVER_PORT`
export CHECK_SERVER_STARTUP_URL="http://127.0.0.1:$HTTP_SERVER_PORT/$SERVER_NAMESPACE/common/ok.jsp"
export STARTUP_SUCCESS_MSG="Server Online Resources ok"
export JAVA_OPTS=" -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true "
export JAVA_DEBUG_OPT=" -server -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=,server=y,suspend=n "
export TIGER_JMX_OPT=" -Dcom.sun.management.config.file=$WEB_APP_HOME/conf/jmx/jmx_monitor_management.properties "
if [ ! -e $JAVA_HOME ]; then
failed "********************************************************************"
failed "**Error: JAVA_HOME $JAVA_HOME not exist"
failed "********************************************************************"
exit 1
fi
if [ ! -e $SERVER_HOME ]; then
failed "********************************************************************"
failed "**Error: SERVER_HOME $SERVER_HOME not exist."
failed "********************************************************************"
exit 1
fi
#========end enviroment var define
if [ $PRODUCTION_MODE = "PRODUCT" ]; then
#after the environment of online is all 64-bit,the below if and else judgement can be delete
str=`file $JAVA_HOME/bin/java | grep 64-bit`
if [ -n "$str" ]; then
let memTotal=`cat /proc/meminfo |grep MemTotal|awk '{printf "%d", $2/1024 }'`
if [ $memTotal -gt 10000 ];then
JAVA_MEM_OPTS=" -server -Xmx4000M -Xms4000M -Xmn600M -XX:PermSize=200M -XX:MaxPermSize=200M -Xss256K -XX:+DisableExplicitGC -XX:SurvivorRatio=1 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=0 -XX:+CMSClassUnloadingEnabled -XX:LargePageSizeInBytes=128M -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=80 -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+PrintGCDetails -XX:+PrintGCApplicationStoppedTime -Xloggc:$WEB_APP_HOME/logs/gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=$WEB_APP_HOME/logs/heapdump.hprof "
else
JAVA_MEM_OPTS=" -server -Xmx1g -Xms1g -Xmn256m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=64m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 "
fi
else
JAVA_MEM_OPTS=" -server -Xms1024m -Xmx1024m -XX:PermSize=128m -XX:SurvivorRatio=2 -XX:+UseParallelGC "
fi
JAVA_OPTS=" $JAVA_OPTS $JAVA_MEM_OPTS "
elif [ $PRODUCTION_MODE = "TEST" ]; then
JAVA_MEM_OPTS=" -server -Xms1024m -Xmx1024m -XX:MaxPermSize=128m -XX:SurvivorRatio=2 -XX:+UseParallelGC "
JAVA_OPTS=" $JAVA_OPTS $JAVA_MEM_OPTS "
elif [ $PRODUCTION_MODE = "DEV" ]; then
#we shuold reduce resource usage on developing mode
JAVA_MEM_OPTS=" -server -Xms64m -Xmx1024m -XX:MaxPermSize=128m "
JAVA_OPTS=" $JAVA_OPTS $JAVA_MEM_OPTS $JAVA_DEBUG_OPT "
else
failed "********************************************************************"
failed "**Error: \$PRODUCTION_MODE should be only: run, test, dev"
failed "********************************************************************"
exit 1
fi
JAVA_OPTS=" $JAVA_OPTS $SERVER_BASE_DIR "
>>>>>>> dev
... ...
... ... @@ -23,7 +23,7 @@
<dependencies>
<dependency>
<groupId>com.yoho.search</groupId>
<artifactId>services</artifactId>
<artifactId>search-service</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
... ... @@ -59,7 +59,7 @@
</dependencies>
<modules>
<module>services</module>
<module>service</module>
<module>web</module>
<module>deploy</module>
</modules>
... ...
... ... @@ -8,7 +8,7 @@
<artifactId>yoho-search-service</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>services</artifactId>
<artifactId>search-service</artifactId>
<dependencies>
<dependency>
... ...
... ... @@ -1601,6 +1601,12 @@ public class SearchService {
int[] brandids = ConvertUtils.stringToIntArray(paramMap.get(ISearchConstans.PARAM_SEARCH_BRAND), ",");
boolFilter.must(FilterBuilders.termsFilter("brandId", brandids));
}
//店铺
if (paramMap.containsKey(ISearchConstans.PARAM_SEARCH_SHOP) && StringUtils.isNotBlank(paramMap.get(ISearchConstans.PARAM_SEARCH_SHOP)) && !ISearchConstans.PARAM_SEARCH_SHOP.equals(filterParamName)) {
int[] shopids = ConvertUtils.stringToIntArray(paramMap.get(ISearchConstans.PARAM_SEARCH_SHOP), ",");
boolFilter.must(FilterBuilders.termsFilter("shopId", shopids));
}
if (paramMap.containsKey(ISearchConstans.PARAM_SEARCH_MAXSORT) && StringUtils.isNotBlank(paramMap.get(ISearchConstans.PARAM_SEARCH_MAXSORT)) && !ISearchConstans.PARAM_SEARCH_MAXSORT.equals(filterParamName)) {
int[] maxsortids = ConvertUtils.stringToIntArray(paramMap.get(ISearchConstans.PARAM_SEARCH_MAXSORT), ",");
boolFilter.must(FilterBuilders.termsFilter("maxSortId", maxsortids));
... ...
... ... @@ -18,7 +18,7 @@
</dependency>
<dependency>
<groupId>com.yoho.search</groupId>
<artifactId>services</artifactId>
<artifactId>search-service</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.search</groupId>
... ...
... ... @@ -78,23 +78,6 @@
<aop:advisor pointcut-ref="serviceMethodPoint" advice-ref="serviceMethodInterceptor"/>
</aop:config>
<!-- Redis 配置 start -->
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxTotal" value="300" />
<property name="maxIdle" value="10" />
<property name="maxWaitMillis" value="1000" />
<property name="testOnBorrow" value="true" />
</bean>
<bean id="jedisPool" class="redis.clients.jedis.JedisPool">
<constructor-arg index="0" ref="jedisPoolConfig" />
<constructor-arg index="1" value="${redis.server}" />
<constructor-arg index="2" value="${redis.port}" />
</bean>
<!-- 包装类 -->
<bean id="redisUtil" class="com.yoho.search.utils.RedisUtil">
<property name="jedisPool" ref="jedisPool" />
</bean>
<bean id="applicationContextUtil" class="com.yoho.search.utils.ApplicationContextUtil">
</bean>
<!-- Redis 配置 end -->
... ...
search.es.cluster.name=yohosearch
search.es.servers=192.168.10.63:9300 192.168.10.64:9300 192.168.10.65:9300
search.es.cluster.name=yohosearch_test
search.es.servers=192.168.102.209:9300
#search.es.cluster.name=yohosearch_online
#search.es.servers=123.57.172.205:9300 123.57.172.107:9300 123.57.172.201:9300
search.index.number_of_replicas=2
... ... @@ -9,10 +9,6 @@ search.index.batch.limit=5000
search.index.batch.limit.tbl=2000
search.index.batch.max.thread.size=10
redis.server=192.168.50.69
redis.port=6379
redis.pool.maxTotal=100
redis.pool.maxIdle=100
redis.pool.maxWaitMillis=2000
... ... @@ -25,16 +21,16 @@ redis.pool.testWhileIdle=true
redis.proxy.address=192.168.50.69
redis.proxy.port=6379
#password, can be empty
redis.proxy.auth=123456
redis.proxy.auth=
redis.readonly.proxy.address=192.168.102.205
redis.readonly.proxy.port=6379
redis.readonly.proxy.auth=123456
redis.readonly.proxy.auth=
mq.server=192.168.10.109
mq.port=5672
mq.username=admin
mq.password=123456
mq.username=admin1
mq.password=123qwe
#mq.server=192.168.50.69
#mq.port=9646
#mq.username=yhb_mq
... ... @@ -48,4 +44,4 @@ tbl.product.private.key=a85bb0674e08986c6b115d5e3a4884fa
tbl.product.url=http://test.soa.global.yohobuy.com/product/api/v1/detail/
search.minimum.should.match=75%
search.operator=and
search.default.field=productName_ansj^10,brandName^500,brandDomain^100,brandNameCn^100,brandNameEn^100,maxSort^300,middleSort^500,smallSort^1000,searchField_ansj,productSkn_ansj,brandNameCn_pinyin^100,maxSort_pinyin^300,middleSort_pinyin^500,smallSort_pinyin^1000,searchField
\ No newline at end of file
search.default.field=productName_ansj^10,brandName^500,brandDomain^100,brandNameCn^100,brandNameEn^100,maxSort^300,middleSort^500,smallSort^1000,searchField_ansj,productSkn_ansj,brandNameCn_pinyin^100,maxSort_pinyin^300,middleSort_pinyin^500,smallSort_pinyin^1000,productKeyword^500,searchField
\ No newline at end of file
... ...
datasources:
yhb_search_2016:
servers:
- 192.168.50.69:9980
- 192.168.50.69:9980
username: yh_test
password: 9nm0icOwt6bMHjMusIfMLw==
- 192.168.102.209:3306
- 192.168.102.209:3306
username: dev
password: dev
readOnlyInSlave: true
\ No newline at end of file
... ...
... ... @@ -2,13 +2,18 @@
<config>
<group>
<property name="yoho.searchservice.env.namespace" defaultValue="yohosearchservice" description="namespace"/>
<property name="yoho.searchservice.env.serverport" defaultValue="8" description="port"/>
<property name="yoho.searchservice.env.webapphome" defaultValue="/home/dev/yoho-search-service/deploy" description="install path"/>
<property name="yoho.search.service.env.namespace" defaultValue="yohosearch" description="namespace"/>
<property name="yoho.search.service.env.serverport" defaultValue="7" description="port"/>
<property name="yoho.search.service.env.webapphome" defaultValue="/home/dev/yoho-search-service/deploy" description="install path"/>
<property name="java.logs.home" defaultValue="/Data/logs" description="日志打印路径"/>
<<<<<<< HEAD
<property name="search.es.cluster.name" defaultValue="yohosearch" description="" />
<property name="search.es.servers" defaultValue="172.16.6.95:9300 " description="" />
=======
<property name="search.es.cluster.name" defaultValue="yohosearch_test" description="" />
<property name="search.es.servers" defaultValue="192.168.102.209:9300" description="" />
>>>>>>> dev
<property name="search.index.number_of_replicas" defaultValue="2" description="" />
<property name="search.index.refresh_interval" defaultValue="1" description="" />
<property name="search.index.translog.flush_threshold_ops" defaultValue="5000" description="" />
... ... @@ -17,7 +22,7 @@
<property name="search.index.batch.max.thread.size" defaultValue="10" description="" />
<property name="search.minimum.should.match" defaultValue="75%" description="" />
<property name="search.operator" defaultValue="and" description="" />
<property name="search.default.field" defaultValue="productName_ansj^10,brandName^500,brandDomain^100,brandNameCn^100,brandNameEn^100,maxSort^300,middleSort^500,smallSort^1000,searchField_ansj,productSkn_ansj,brandNameCn_pinyin^100,maxSort_pinyin^300,middleSort_pinyin^500,smallSort_pinyin^1000,searchField" description="" />
<property name="search.default.field" defaultValue="productName_ansj^10,brandName^500,brandDomain^100,brandNameCn^100,brandNameEn^100,maxSort^300,middleSort^500,smallSort^1000,searchField_ansj,productSkn_ansj,brandNameCn_pinyin^100,maxSort_pinyin^300,middleSort_pinyin^500,smallSort_pinyin^1000,productKeyword^500,searchField" description="" />
<property name="search.script.score" defaultValue="_score+doc['sortWeight'].value*0.003+(100-doc['breakingRate'].value)/100 * doc['salesWithDateDiff'].value/pow((now-doc['shelveTime'].value)/3600+2,1.8)" description="" />
<property name="search.script.lang" defaultValue="groovy" description="" />
... ... @@ -35,26 +40,31 @@
<property name="redis.proxy.address" defaultValue="192.168.102.216" description="" />
<property name="redis.proxy.port" defaultValue="6379" description="" />
<property name="redis.readonly.proxy.address" defaultValue="192.168.102.216" description="" />
<property name="redis.readonly.proxy.port" defaultValue="6379" description="" />
<property name="redis.pool.maxTotal" defaultValue="100" description="" />
<property name="redis.pool.maxIdle" defaultValue="100" description="" />
<property name="redis.pool.maxWaitMillis" defaultValue="2000" description="" />
<property name="redis.pool.minIdle" defaultValue="50" description="" />
<property name="redis.pool.testOnBorrow" defaultValue="false" description="" />
<property name="redis.pool.testWhileIdle" defaultValue="true" description="" />
<property name="rabbit.mq.prefix" defaultValue="no_" description="" />
<property name="tbl.product.private.key" defaultValue="a85bb0674e08986c6b115d5e3a4884fa" description="" />
<property name="tbl.product.url" defaultValue="http://test.soa.global.yohobuy.com/product/api/v1/detail/" description="" />
<property name="keyword.user.choice.file" defaultValue="/Users/ming/source/logs/fake.csv" description="" />
<property name="yoho.logs.basedir" defaultValue="/Users/ming/source/logs/" description="" />
<property name="yoho.logs.maxFileSize" defaultValue="10MB" description="" />
<property name="yoho.logs.maxHistory" defaultValue="7" description="" />
<property name="yoho.logs.level" defaultValue="DEBUG" description="" />
<property name="jdbc.mysql.yhbsearch.master" defaultValue="192.168.50.69:9980" description="" />
<property name="jdbc.mysql.yhbsearch.slave" defaultValue="192.168.102.219:3306" description="" />
<property name="jdbc.mysql.yhbsearch.master" defaultValue="192.168.102.209:3306" description="" />
<property name="jdbc.mysql.yhbsearch.slave" defaultValue="192.168.102.209:3306" description="" />
<property name="jdbc.mysql.yhbsearch.username" defaultValue="yh_test" description="" />
<property name="jdbc.mysql.yhbsearch.password" defaultValue="9nm0icOwt6bMHjMusIfMLw==" description="" />
<property name="jdbc.mysql.yhbsearch.datasources" defaultValue="yhb_search_2016" description="" />
</group>
<script>
<generate template="META-INF/autoconf/databases.yml" destfile="WEB-INF/classes/databases.yml"/>
<generate template="META-INF/autoconf/logback.xml" destfile="WEB-INF/classes/logback.xml"/>
<generate template="META-INF/autoconf/config.properties" destfile="WEB-INF/classes/config.properties"/>
</script>
</config>
... ...
... ... @@ -9,6 +9,9 @@ redis.proxy.address=${redis.proxy.address}
redis.proxy.auth=${redis.proxy.auth}
redis.proxy.port = ${redis.proxy.port}
redis.readonly.proxy.address=${redis.readonly.proxy.address}
redis.readonly.proxy.port=${redis.readonly.proxy.port}
redis.readonly.proxy.auth=${redis.readonly.proxy.auth}
coupon.send.time.interval.sendOrderConfirmCoupon=604800
order.task.host=${order.task.host}
... ... @@ -18,10 +21,15 @@ web.context=search
redis.server=${redis.server}
redis.port=${redis.port}
driver=${jdbc.driver.name}
url=${jdbc.url}
username=${jdbc.username}
password=${jdbc.password}
redis.pool.maxTotal=${redis.pool.maxTotal}
redis.pool.maxIdle=${redis.pool.maxIdle}
redis.pool.maxWaitMillis=${redis.pool.maxWaitMillis}
redis.pool.minIdle=${redis.pool.minIdle}
redis.pool.testOnBorrow=${redis.pool.testOnBorrow}
redis.pool.testWhileIdle=${redis.pool.testWhileIdle}
# ******************** redis servers ********************
#redis.proxy.address=192.168.102.205
mq.server=${mq.server}
mq.port=${mq.port}
... ...
datasources:
<<<<<<< HEAD
yhb_search_2016:
=======
${jdbc.mysql.yhbsearch.datasources}:
>>>>>>> dev
servers:
- ${jdbc.mysql.yhbsearch.master}
- ${jdbc.mysql.yhbsearch.slave}
... ...
... ... @@ -10,15 +10,37 @@
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- WARN、ERROR级别日志 appender -->
<appender name="DEBUG_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${yoho.logs.basedir}/${yoho.search.service.env.namespace}/debug.log</file>
<!-- 过滤器,过滤掉 TRACE 和 DEBUG 和 INFO 级别的日志 -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>${yoho.logs.basedir}/${yoho.search.service.env.namespace}/archived/debug.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 100MB -->
<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- keep 30 days' worth of history -->
<maxHistory>${yoho.logs.maxHistory}</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- WARN、ERROR级别日志 appender -->
<appender name="WARN_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${yoho.logs.basedir}/${yoho.search.env.namespace}/warn-log.log</file>
<file>${yoho.logs.basedir}/${yoho.search.service.env.namespace}/warn.log</file>
<!-- 过滤器,过滤掉 TRACE 和 DEBUG 和 INFO 级别的日志 -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>${yoho.logs.basedir}/${yoho.search.env.namespace}/archived/warn.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<fileNamePattern>${yoho.logs.basedir}/${yoho.search.service.env.namespace}/archived/warn.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 100MB -->
<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
... ... @@ -34,10 +56,10 @@
<!-- HTTP请求超时 appender -->
<appender name="REQUEST_TIMEOUT" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${yoho.logs.basedir}/${yoho.search.env.namespace}/request-timeout.log</file>
<file>${yoho.logs.basedir}/${yoho.search.service.env.namespace}/request-timeout.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>${yoho.logs.basedir}/${yoho.search.env.namespace}/archived/request-timeout.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<fileNamePattern>${yoho.logs.basedir}/${yoho.search.service.env.namespace}/archived/request-timeout.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 100MB -->
<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
... ... @@ -52,10 +74,10 @@
<!-- 数据库超时日志 appender -->
<appender name="DATABASE_TIMEOUT" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${yoho.logs.basedir}/${yoho.search.env.namespace}/database-timeout.log</file>
<file>${yoho.logs.basedir}/${yoho.search.service.env.namespace}/database-timeout.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>${yoho.logs.basedir}/${yoho.search.env.namespace}/archived/database-timeout.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<fileNamePattern>${yoho.logs.basedir}/${yoho.search.service.env.namespace}/archived/database-timeout.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 100MB -->
<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
... ... @@ -70,10 +92,10 @@
<!-- 服务请求统计 appender -->
<appender name="REQUEST_STAT" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${yoho.logs.basedir}/${yoho.search.env.namespace}/request-stat.log</file>
<file>${yoho.logs.basedir}/${yoho.search.service.env.namespace}/request-stat.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>${yoho.logs.basedir}/${yoho.search.env.namespace}/archived/request-stat.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<fileNamePattern>${yoho.logs.basedir}/${yoho.search.service.env.namespace}/archived/request-stat.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 100MB -->
<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
... ... @@ -99,6 +121,7 @@
<!-- root级别 DEBUG -->
<root level="${yoho.logs.level}">
<!-- 文件输出 -->
<appender-ref ref="DEBUG_LOG" />
<appender-ref ref="WARN_LOG" />
</root>
... ...