
13 changed files with 225 additions and 25 deletions
@ -0,0 +1,19 @@ |
|||
package com.wh.config; |
|||
|
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.context.annotation.Configuration; |
|||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
|||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
|||
@Configuration |
|||
public class WebMvcConfig implements WebMvcConfigurer { |
|||
@Value("${yuan.file.root.path}") |
|||
public String fileRootPath; |
|||
|
|||
/** |
|||
* 资源映射:把请求的/archive/** 映射到该文件根路径 |
|||
*/ |
|||
@Override |
|||
public void addResourceHandlers(ResourceHandlerRegistry registry) { |
|||
registry.addResourceHandler("/archive/**").addResourceLocations("file:" + fileRootPath); |
|||
} |
|||
} |
@ -0,0 +1,37 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<configuration> |
|||
|
|||
<property name="log.base" value="logs/supervise-dispatchcenter" /> |
|||
|
|||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
|||
<encoder> |
|||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n |
|||
</pattern> |
|||
<!--<charset>UTF-8</charset> --> |
|||
</encoder> |
|||
</appender> |
|||
|
|||
<appender name="FILEOUT" |
|||
class="ch.qos.logback.core.rolling.RollingFileAppender"> |
|||
<file>${log.base}.log</file> |
|||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
|||
<fileNamePattern>${log.base}.%d{yyyyMMdd}.%i.log.zip |
|||
</fileNamePattern> |
|||
<!-- 当文件大小超过10MB时触发滚动 --> |
|||
<timeBasedFileNamingAndTriggeringPolicy |
|||
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
|||
<maxFileSize>1MB</maxFileSize> |
|||
</timeBasedFileNamingAndTriggeringPolicy> |
|||
</rollingPolicy> |
|||
<encoder> |
|||
<pattern>%date [%thread] %-5level %logger{35} - %msg%n</pattern> |
|||
<!--<charset>UTF-8</charset> --> |
|||
</encoder> |
|||
</appender> |
|||
|
|||
<root level="DEBUG"> |
|||
<appender-ref ref="STDOUT" /> |
|||
<appender-ref ref="FILEOUT" /> |
|||
</root> |
|||
|
|||
</configuration> |
Loading…
Reference in new issue