spring boot几个初始配置文件
一、gradle
// https://mvnrepository.com/artifact/com.squareup.okhttp/okhttp compile group: 'com.squareup.okhttp', name: 'okhttp', version: '2.7.5' // https://mvnrepository.com/artifact/commons-codec/commons-codec compile group: 'commons-codec', name: 'commons-codec', version: '1.9' compile("org.springframework.boot:spring-boot-starter-web:1.5.3.RELEASE")
二、application.properties
logging.level.root=WARN logging.level.org.springframework.web=DEBUG logging.level.org.hibernate=ERROR logging.level.com.vvhi=DEBUG
三、logback.xml
<?xml version="1.0" encoding="UTF-8"?> <configuration> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} %level [%thread][%file:%line] - %msg%n</pattern> <charset>utf-8</charset> </encoder> </appender> <appender name="baselog" class="ch.qos.logback.core.rolling.RollingFileAppender"> <File>/var/log/proxy.log</File> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>/var/log/proxy.log.%d.%i</fileNamePattern> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <!-- or whenever the file size reaches 64 MB --> <maxFileSize>64 MB</maxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy> <encoder> <pattern> %date{yyyy-MM-dd HH:mm:ss.SSS} %level [%thread][%file:%line] - %msg%n </pattern> <charset>UTF-8</charset> <!-- 此处设置字符集 --> </encoder> </appender> <root level="info"> <appender-ref ref="STDOUT" /> </root> <logger name="com.vvhi" level="DEBUG"> <appender-ref ref="baselog" /> </logger> </configuration>
上善若水,水利万物而不争。