Authored by hugufei

Merge branch 'master' into dev

@@ -275,6 +275,8 @@ public class SearchController { @@ -275,6 +275,8 @@ public class SearchController {
275 String val = ((String[]) paramMap.get(key))[0]; 275 String val = ((String[]) paramMap.get(key))[0];
276 resultMap.put(key, val); 276 resultMap.put(key, val);
277 } 277 }
  278 + resultMap.put("Referer", request.getHeader("Referer"));
  279 + resultMap.put("User-Agent", request.getHeader("User-Agent"));
278 return resultMap; 280 return resultMap;
279 } 281 }
280 282
@@ -130,6 +130,24 @@ @@ -130,6 +130,24 @@
130 </encoder> 130 </encoder>
131 </appender> 131 </appender>
132 132
  133 + <!-- 缓存命中统计 appender -->
  134 + <appender name="CACHE_MATCH" class="ch.qos.logback.core.rolling.RollingFileAppender">
  135 + <file>${yoho.logs.basedir}/${yoho.search.service.env.namespace}/cache-match.log</file>
  136 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  137 + <!-- daily rollover -->
  138 + <fileNamePattern>${yoho.logs.basedir}/${yoho.search.service.env.namespace}/archived/cache-match.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
  139 + <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  140 + <!-- or whenever the file size reaches 100MB -->
  141 + <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
  142 + </timeBasedFileNamingAndTriggeringPolicy>
  143 + <!-- keep 30 days' worth of history -->
  144 + <maxHistory>${yoho.logs.maxHistory}</maxHistory>
  145 + </rollingPolicy>
  146 + <encoder>
  147 + <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger:%line - %msg%n</pattern>
  148 + </encoder>
  149 + </appender>
  150 +
133 <!-- 数据库操作日志 --> 151 <!-- 数据库操作日志 -->
134 <logger name="java.sql.PreparedStatement" value="${yoho.logs.level}" /> 152 <logger name="java.sql.PreparedStatement" value="${yoho.logs.level}" />
135 <logger name="java.sql.Connection" value="${yoho.logs.level}" /> 153 <logger name="java.sql.Connection" value="${yoho.logs.level}" />
@@ -166,4 +184,10 @@ @@ -166,4 +184,10 @@
166 <appender-ref ref="REQUEST_STAT"/> 184 <appender-ref ref="REQUEST_STAT"/>
167 </logger> 185 </logger>
168 186
  187 + <!-- 缓存命中统计日志 -->
  188 + <logger name="com.yoho.search.cache.CacheService" additivity="false">
  189 + <level value="INFO"/>
  190 + <appender-ref ref="CACHE_MATCH"/>
  191 + </logger>
  192 +
169 </configuration> 193 </configuration>