springboot整合logback集成elk实现日志的汇总、分析、统计和检索功能
在Spring Boot当中,默认使用logback进行log操作。logback支持将日志数据通过提供IP地址、端口号,以Socket的方式远程发送。在Spring Boot中,通常使用logback-spring.xml来进行logback配置。
首先、创建一个elk的springboot项目,然后先对logback进行配置,配置各项的详细说明可以去看http://aub.iteye.com/blog/1101222,说的很详细。也多参考一下别人关于日志的描述https://www.cnblogs.com/mr-yang-localhost/p/8284317.html
logback代码
<?xml version="1.0" encoding="UTF-8"?>
<!-- 设置配置文件如果改动自动加载,监测是否修改时间间隔为60s,不打印logback内部日志信息 -->
<configuration scan="true" scanPeriod="60 seconds" debug="true">
<!--设置上下文名称 -->
<property name="appName" value="elk"/>
<contextName>${appName}</contextName>
<!-- <timestamp key="" datePattern=""/> -->
<!-- 存放日志地址 -->
<property name="log_home" value="loghome"/>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} {%thread} %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>./${log_home}/elk.log</file>
<Encoding>UTF-8</Encoding>
<rollingPolicy class="ch.qos.logback.core.rolling.RollingPolicy">
日志文件输出的文件名
<FileNamePattern>${log_home}/elk.log.%d{yyyy-MM-dd}.log</FileNamePattern>
日志保留30天
<MaxHistory>30</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>10MB</MaxFileSize>
</triggeringPolicy>
</appender>
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="TRACE"/>
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/> <!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
<!--
日志异步到数据库
<appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
日志异步到数据库
<connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
连接池
<dataSource class="com.mchange.v2.c3p0.ComboPooledDataSource">
<driverClass>com.mysql.jdbc.Driver</driverClass>
<url>jdbc:mysql://127.0.0.1:3306/databaseName</url>
<user>root</user>
<password>root</password>
</dataSource>
</connectionSource>
</appender> -->
</configuration>
yml
logging:
config: classpath:logback-spring.xml
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/test
username: root
password: 123456 注意:加载logback的配置文件一定要有classpath: 否则报错
运行测试类
package com.zxy.demo; import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class)
@SpringBootTest
public class ElkApplicationTests {
private Logger logger = LoggerFactory.getLogger(this.getClass()); @Test
public void contextLoads() {
}
@Test
public void testLog() {
logger.info("message:this is first logger!");
}
}
效果
11:57:36,907 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Will scan for changes in [file:/D:/worksheet/elk/target/classes/logback-spring.xml]
11:57:36,909 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Setting ReconfigureOnChangeTask scanning period to 1 minutes
11:57:36,913 |-INFO in ch.qos.logback.classic.joran.action.ContextNameAction - Setting logger context name as [elk]
11:57:36,913 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
11:57:36,914 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
11:57:36,933 |-WARN in Logger[org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator] - No appenders present in context [elk] for logger [org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator].
11:57:36,942 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.FileAppender]
11:57:36,944 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE]
11:57:36,945 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@19:19 - no applicable action for [Encoding], current ElementPath is [[configuration][appender][Encoding]]
11:57:36,945 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@20:68 - no applicable action for [rollingPolicy], current ElementPath is [[configuration][appender][rollingPolicy]]
11:57:36,946 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@22:21 - no applicable action for [FileNamePattern], current ElementPath is [[configuration][appender][rollingPolicy][FileNamePattern]]
11:57:36,946 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@24:16 - no applicable action for [MaxHistory], current ElementPath is [[configuration][appender][rollingPolicy][MaxHistory]]
11:57:36,947 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@30:83 - no applicable action for [triggeringPolicy], current ElementPath is [[configuration][appender][triggeringPolicy]]
11:57:36,947 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@31:23 - no applicable action for [MaxFileSize], current ElementPath is [[configuration][appender][triggeringPolicy][MaxFileSize]]
11:57:36,947 |-INFO in ch.qos.logback.core.FileAppender[FILE] - File property is set to [./loghome/elk.log]
11:57:36,950 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.apache.ibatis] to TRACE
11:57:36,950 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@5f058f00 - Propagating TRACE level on Logger[com.apache.ibatis] onto the JUL framework
11:57:36,950 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [java.sql.Connection] to DEBUG
11:57:36,950 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@5f058f00 - Propagating DEBUG level on Logger[java.sql.Connection] onto the JUL framework
11:57:36,950 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [java.sql.Statement] to DEBUG
11:57:36,950 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@5f058f00 - Propagating DEBUG level on Logger[java.sql.Statement] onto the JUL framework
11:57:36,951 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [java.sql.PreparedStatement] to DEBUG
11:57:36,951 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@5f058f00 - Propagating DEBUG level on Logger[java.sql.PreparedStatement] onto the JUL framework
11:57:36,951 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
11:57:36,951 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@5f058f00 - Propagating INFO level on Logger[ROOT] onto the JUL framework
11:57:36,951 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
11:57:36,952 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE] to Logger[ROOT]
11:57:36,952 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
11:57:36,952 |-INFO in org.springframework.boot.logging.logback.SpringBootJoranConfigurator@479d31f3 - Registering current configuration as safe fallback point
Logging system failed to initialize using configuration from 'classpath:logback-spring.xml'
java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.joran.spi.Interpreter@19:19 - no applicable action for [Encoding], current ElementPath is [[configuration][appender][Encoding]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@20:68 - no applicable action for [rollingPolicy], current ElementPath is [[configuration][appender][rollingPolicy]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@22:21 - no applicable action for [FileNamePattern], current ElementPath is [[configuration][appender][rollingPolicy][FileNamePattern]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@24:16 - no applicable action for [MaxHistory], current ElementPath is [[configuration][appender][rollingPolicy][MaxHistory]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@30:83 - no applicable action for [triggeringPolicy], current ElementPath is [[configuration][appender][triggeringPolicy]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@31:23 - no applicable action for [MaxFileSize], current ElementPath is [[configuration][appender][triggeringPolicy][MaxFileSize]]
at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:169)
at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithSpecificConfig(AbstractLoggingSystem.java:67)
at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:57)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:117)
at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:269)
at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:237)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:200)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:173)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:364)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:323)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265)
at com.zxy.demo.ElkApplication.main(ElkApplication.java:11)
2018-10-01 11:57:37.464 {main} ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.joran.spi.Interpreter@19:19 - no applicable action for [Encoding], current ElementPath is [[configuration][appender][Encoding]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@20:68 - no applicable action for [rollingPolicy], current ElementPath is [[configuration][appender][rollingPolicy]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@22:21 - no applicable action for [FileNamePattern], current ElementPath is [[configuration][appender][rollingPolicy][FileNamePattern]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@24:16 - no applicable action for [MaxHistory], current ElementPath is [[configuration][appender][rollingPolicy][MaxHistory]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@30:83 - no applicable action for [triggeringPolicy], current ElementPath is [[configuration][appender][triggeringPolicy]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@31:23 - no applicable action for [MaxFileSize], current ElementPath is [[configuration][appender][triggeringPolicy][MaxFileSize]]
at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:276)
at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:237)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:200)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:173)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:364)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:323)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265)
at com.zxy.demo.ElkApplication.main(ElkApplication.java:11)
Caused by: java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.joran.spi.Interpreter@19:19 - no applicable action for [Encoding], current ElementPath is [[configuration][appender][Encoding]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@20:68 - no applicable action for [rollingPolicy], current ElementPath is [[configuration][appender][rollingPolicy]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@22:21 - no applicable action for [FileNamePattern], current ElementPath is [[configuration][appender][rollingPolicy][FileNamePattern]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@24:16 - no applicable action for [MaxHistory], current ElementPath is [[configuration][appender][rollingPolicy][MaxHistory]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@30:83 - no applicable action for [triggeringPolicy], current ElementPath is [[configuration][appender][triggeringPolicy]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@31:23 - no applicable action for [MaxFileSize], current ElementPath is [[configuration][appender][triggeringPolicy][MaxFileSize]]
at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:169)
at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithSpecificConfig(AbstractLoggingSystem.java:67)
at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:57)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:117)
at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:269)
... 14 common frames omitted
Exception in thread "main" java.lang.IllegalStateException: java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.joran.spi.Interpreter@19:19 - no applicable action for [Encoding], current ElementPath is [[configuration][appender][Encoding]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@20:68 - no applicable action for [rollingPolicy], current ElementPath is [[configuration][appender][rollingPolicy]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@22:21 - no applicable action for [FileNamePattern], current ElementPath is [[configuration][appender][rollingPolicy][FileNamePattern]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@24:16 - no applicable action for [MaxHistory], current ElementPath is [[configuration][appender][rollingPolicy][MaxHistory]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@30:83 - no applicable action for [triggeringPolicy], current ElementPath is [[configuration][appender][triggeringPolicy]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@31:23 - no applicable action for [MaxFileSize], current ElementPath is [[configuration][appender][triggeringPolicy][MaxFileSize]]
at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:276)
at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:237)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:200)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:173)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:364)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:323)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265)
at com.zxy.demo.ElkApplication.main(ElkApplication.java:11)
Caused by: java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.joran.spi.Interpreter@19:19 - no applicable action for [Encoding], current ElementPath is [[configuration][appender][Encoding]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@20:68 - no applicable action for [rollingPolicy], current ElementPath is [[configuration][appender][rollingPolicy]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@22:21 - no applicable action for [FileNamePattern], current ElementPath is [[configuration][appender][rollingPolicy][FileNamePattern]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@24:16 - no applicable action for [MaxHistory], current ElementPath is [[configuration][appender][rollingPolicy][MaxHistory]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@30:83 - no applicable action for [triggeringPolicy], current ElementPath is [[configuration][appender][triggeringPolicy]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@31:23 - no applicable action for [MaxFileSize], current ElementPath is [[configuration][appender][triggeringPolicy][MaxFileSize]]
at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:169)
at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithSpecificConfig(AbstractLoggingSystem.java:67)
at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:57)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:117)
at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:269)
... 14 more
报错是因为引用的apender选择错误,更改相应代码
logback代码更改后:
<?xml version="1.0" encoding="UTF-8"?>
<!-- 设置配置文件如果改动自动加载,监测是否修改时间间隔为60s,不打印logback内部日志信息 -->
<configuration scan="true" scanPeriod="60 seconds" debug="true">
<!--设置上下文名称 -->
<property name="appName" value="elk"/>
<contextName>${appName}</contextName>
<!-- <timestamp key="" datePattern=""/> -->
<!-- 存放日志地址 -->
<property name="log_home" value="d:/"/>
<!-- 控制台输出 -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} {%thread} %-5level %logger{50} =======> %msg%n</pattern>
</encoder>
</appender>
<!-- 滚动记录日志 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <!-- 类要引用正确ch.qos.logback.core.FileAppender -->
<file>${log_home}/elk.log</file> <!-- 引用ch.qos.logback.core.FileAppender需要的属性,这里不需要-->
<!-- <append>true</append> -->
<!-- <Encoding>UTF-8</Encoding> 1.17版本后不能用,去掉 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- 不是ch.qos.logback.core.rolling.RollingPolicy -->
<!-- 日志文件输出的文件名 -->
<fileNamePattern>${log_home}/%d{yyyy-MM-dd}/error-log.log</fileNamePattern>
<!-- 日志保留30天 -->
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!-- 格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} {%thread} %-5level %logger{50} =======> %msg%n</pattern>
</encoder>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>10MB</MaxFileSize>
</triggeringPolicy>
</appender>
<!--myibatis log configure-->
<logger name="com.apache.ibatis" level="TRACE"/>
<logger name="java.sql.Connection" level="DEBUG"/>
<logger name="java.sql.Statement" level="DEBUG"/>
<logger name="java.sql.PreparedStatement" level="DEBUG"/> <!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
</root>
<!--
日志异步到数据库
<appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
日志异步到数据库
<connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">
连接池
<dataSource class="com.mchange.v2.c3p0.ComboPooledDataSource">
<driverClass>com.mysql.jdbc.Driver</driverClass>
<url>jdbc:mysql://127.0.0.1:3306/databaseName</url>
<user>root</user>
<password>root</password>
</dataSource>
</connectionSource>
</appender> -->
</configuration>
再次运行看一下效果
13:13:24.339 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class com.zxy.demo.ElkApplicationTests]
13:13:24.359 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
13:13:24.370 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
13:13:24.392 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.zxy.demo.ElkApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
13:13:24.409 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.zxy.demo.ElkApplicationTests], using SpringBootContextLoader
13:13:24.416 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.zxy.demo.ElkApplicationTests]: class path resource [com/zxy/demo/ElkApplicationTests-context.xml] does not exist
13:13:24.417 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.zxy.demo.ElkApplicationTests]: class path resource [com/zxy/demo/ElkApplicationTestsContext.groovy] does not exist
13:13:24.417 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.zxy.demo.ElkApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
13:13:24.418 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.zxy.demo.ElkApplicationTests]: ElkApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
13:13:24.479 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.zxy.demo.ElkApplicationTests]
13:13:24.492 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding PropertySource 'systemProperties' with lowest search precedence
13:13:24.493 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding PropertySource 'systemEnvironment' with lowest search precedence
13:13:24.493 [main] DEBUG org.springframework.core.env.StandardEnvironment - Initialized StandardEnvironment with PropertySources [MapPropertySource@1630521067 {name='systemProperties', properties={java.runtime.name=Java(TM) SE Runtime Environment, sun.boot.library.path=D:\java\java1.8\jre1.8\bin, java.vm.version=25.161-b12, java.vm.vendor=Oracle Corporation, java.vendor.url=http://java.oracle.com/, path.separator=;, java.vm.name=Java HotSpot(TM) 64-Bit Server VM, file.encoding.pkg=sun.io, user.country=CN, user.script=, sun.java.launcher=SUN_STANDARD, sun.os.patch.level=, java.vm.specification.name=Java Virtual Machine Specification, user.dir=D:\worksheet\elk, java.runtime.version=1.8.0_161-b12, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=D:\java\java1.8\jre1.8\lib\endorsed, os.arch=amd64, java.io.tmpdir=C:\Users\litan\AppData\Local\Temp\, line.separator=
, java.vm.specification.vendor=Oracle Corporation, user.variant=, os.name=Windows 10, sun.jnu.encoding=GBK, java.library.path=D:\java\java1.8\jre1.8\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\ProgramData\Oracle\Java\javapath;D:\java\oracle\product\11.2.0\dbhome_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\lenovo\easyplussdk\bin;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.2 & MySQL Utilities 1.5.2 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.2 & MySQL Utilities 1.5.2 1.5\Doctrine extensions for PHP\;D:\java\java1.8\jdk1.8\bin;JAVA_HOME%\jre\bin;D:\java\Z_review\apache-tomcat-7.0.67\bin;D:\我的软件;办公软;\svnServer\bin;%ma;en_home%\bin;D:\我的软件\数据库\putty\;C:\Pro;ram Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;";D:\我的软件\专业软件\zookeeper\zookeeper-3.4.9/bin; D:\我的软件\专业软件\zookeeper\zookeeper-3.4.9/conf";D:\java\java1.8\jdk1.8\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;D:\java软件安装资源汇总\maven建项目\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin;D:\protobufc\bin;C:\Users\litan\AppData\Local\Microsoft\WindowsApps;D:\java软件安装资源汇总\2017-6-25\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin;;., java.specification.name=Java Platform API Specification, java.class.version=52.0, sun.management.compiler=HotSpot 64-Bit Tiered Compilers, os.version=10.0, user.home=C:\Users\litan, user.timezone=Asia/Shanghai, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=UTF-8, java.specification.version=1.8, java.class.path=D:\worksheet\elk\target\test-classes;D:\worksheet\elk\target\classes;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.0.5.RELEASE\spring-boot-starter-web-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-starter\2.0.5.RELEASE\spring-boot-starter-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot\2.0.5.RELEASE\spring-boot-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.0.5.RELEASE\spring-boot-autoconfigure-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.0.5.RELEASE\spring-boot-starter-logging-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\litan\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\litan\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.10.0\log4j-to-slf4j-2.10.0.jar;C:\Users\litan\.m2\repository\org\apache\logging\log4j\log4j-api\2.10.0\log4j-api-2.10.0.jar;C:\Users\litan\.m2\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;C:\Users\litan\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;C:\Users\litan\.m2\repository\org\yaml\snakeyaml\1.19\snakeyaml-1.19.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.0.5.RELEASE\spring-boot-starter-json-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.6\jackson-databind-2.9.6.jar;C:\Users\litan\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;C:\Users\litan\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.9.6\jackson-core-2.9.6.jar;C:\Users\litan\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.6\jackson-datatype-jdk8-2.9.6.jar;C:\Users\litan\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.6\jackson-datatype-jsr310-2.9.6.jar;C:\Users\litan\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.6\jackson-module-parameter-names-2.9.6.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.0.5.RELEASE\spring-boot-starter-tomcat-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.34\tomcat-embed-core-8.5.34.jar;C:\Users\litan\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.34\tomcat-embed-el-8.5.34.jar;C:\Users\litan\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.34\tomcat-embed-websocket-8.5.34.jar;C:\Users\litan\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.12.Final\hibernate-validator-6.0.12.Final.jar;C:\Users\litan\.m2\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;C:\Users\litan\.m2\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;C:\Users\litan\.m2\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;C:\Users\litan\.m2\repository\org\springframework\spring-web\5.0.9.RELEASE\spring-web-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\spring-beans\5.0.9.RELEASE\spring-beans-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\spring-webmvc\5.0.9.RELEASE\spring-webmvc-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\spring-aop\5.0.9.RELEASE\spring-aop-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\spring-context\5.0.9.RELEASE\spring-context-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\spring-expression\5.0.9.RELEASE\spring-expression-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-starter\1.3.2\mybatis-spring-boot-starter-1.3.2.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.0.5.RELEASE\spring-boot-starter-jdbc-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\com\zaxxer\HikariCP\2.7.9\HikariCP-2.7.9.jar;C:\Users\litan\.m2\repository\org\springframework\spring-jdbc\5.0.9.RELEASE\spring-jdbc-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\spring-tx\5.0.9.RELEASE\spring-tx-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\1.3.2\mybatis-spring-boot-autoconfigure-1.3.2.jar;C:\Users\litan\.m2\repository\org\mybatis\mybatis\3.4.6\mybatis-3.4.6.jar;C:\Users\litan\.m2\repository\org\mybatis\mybatis-spring\1.3.2\mybatis-spring-1.3.2.jar;C:\Users\litan\.m2\repository\mysql\mysql-connector-java\5.1.47\mysql-connector-java-5.1.47.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-starter-test\2.0.5.RELEASE\spring-boot-starter-test-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-test\2.0.5.RELEASE\spring-boot-test-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-test-autoconfigure\2.0.5.RELEASE\spring-boot-test-autoconfigure-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\com\jayway\jsonpath\json-path\2.4.0\json-path-2.4.0.jar;C:\Users\litan\.m2\repository\net\minidev\json-smart\2.3\json-smart-2.3.jar;C:\Users\litan\.m2\repository\net\minidev\accessors-smart\1.2\accessors-smart-1.2.jar;C:\Users\litan\.m2\repository\org\ow2\asm\asm\5.0.4\asm-5.0.4.jar;C:\Users\litan\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\litan\.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\litan\.m2\repository\org\assertj\assertj-core\3.9.1\assertj-core-3.9.1.jar;C:\Users\litan\.m2\repository\org\mockito\mockito-core\2.15.0\mockito-core-2.15.0.jar;C:\Users\litan\.m2\repository\net\bytebuddy\byte-buddy\1.7.11\byte-buddy-1.7.11.jar;C:\Users\litan\.m2\repository\net\bytebuddy\byte-buddy-agent\1.7.11\byte-buddy-agent-1.7.11.jar;C:\Users\litan\.m2\repository\org\objenesis\objenesis\2.6\objenesis-2.6.jar;C:\Users\litan\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\litan\.m2\repository\org\hamcrest\hamcrest-library\1.3\hamcrest-library-1.3.jar;C:\Users\litan\.m2\repository\org\skyscreamer\jsonassert\1.5.0\jsonassert-1.5.0.jar;C:\Users\litan\.m2\repository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;C:\Users\litan\.m2\repository\org\springframework\spring-core\5.0.9.RELEASE\spring-core-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\spring-jcl\5.0.9.RELEASE\spring-jcl-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\spring-test\5.0.9.RELEASE\spring-test-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\xmlunit\xmlunit-core\2.5.1\xmlunit-core-2.5.1.jar;D:\javaDevlepTool\eclipse4.8\eclipse\configuration\org.eclipse.osgi\416\0\.cp;D:\javaDevlepTool\eclipse4.8\eclipse\configuration\org.eclipse.osgi\415\0\.cp, user.name=litan, java.vm.specification.version=1.8, sun.java.command=org.eclipse.jdt.internal.junit.runner.RemoteTestRunner -version 3 -port 52767 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -test com.zxy.demo.ElkApplicationTests:testLog, java.home=D:\java\java1.8\jre1.8, sun.arch.data.model=64, user.language=zh, java.specification.vendor=Oracle Corporation, awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, java.version=1.8.0_161, java.ext.dirs=D:\java\java1.8\jre1.8\lib\ext;C:\WINDOWS\Sun\Java\lib\ext, sun.boot.class.path=D:\java\java1.8\jre1.8\lib\resources.jar;D:\java\java1.8\jre1.8\lib\rt.jar;D:\java\java1.8\jre1.8\lib\sunrsasign.jar;D:\java\java1.8\jre1.8\lib\jsse.jar;D:\java\java1.8\jre1.8\lib\jce.jar;D:\java\java1.8\jre1.8\lib\charsets.jar;D:\java\java1.8\jre1.8\lib\jfr.jar;D:\java\java1.8\jre1.8\classes, java.vendor=Oracle Corporation, file.separator=\, java.vendor.url.bug=http://bugreport.sun.com/bugreport/, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.desktop=windows, sun.cpu.isalist=amd64}}, SystemEnvironmentPropertySource@274773041 {name='systemEnvironment', properties={configsetroot=C:\WINDOWS\ConfigSetRoot, USERDOMAIN_ROAMINGPROFILE=LITAN, PROCESSOR_LEVEL=6, SESSIONNAME=Console, ALLUSERSPROFILE=C:\ProgramData, PROCESSOR_ARCHITECTURE=AMD64, PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;D:\我的软件\办公软件\svnServer\PowerShellModules, SystemDrive=C:, MAVEN_HOME=D:\java软件安装资源汇总\maven建项目\apache-maven-3.3.9-bin\apache-maven-3.3.9, USERNAME=litan, ProgramFiles(x86)=C:\Program Files (x86), VISUALSVN_SERVER=D:\我的软件\办公软件\svnServer\, FPS_BROWSER_USER_PROFILE_STRING=Default, PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC, DriverData=C:\Windows\System32\Drivers\DriverData, ProgramData=C:\ProgramData, ProgramW6432=C:\Program Files, HOMEPATH=\Users\litan, PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 61 Stepping 4, GenuineIntel, ProgramFiles=C:\Program Files, PUBLIC=C:\Users\Public, windir=C:\WINDOWS, =::=::\, ZOOKEEPER_HOME=D:\我的软件\专业软件\zookeeper\zookeeper-3.4.9, LOCALAPPDATA=C:\Users\litan\AppData\Local, USERDOMAIN=LITAN, FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer, LOGONSERVER=\\LITAN, JAVA_HOME=D:\java\java1.8\jdk1.8, ERLANG_HOME=D:\topband\soft\RabbitMQ\erl7.1, OneDrive=C:\Users\litan\OneDrive, =C:=C:\, APPDATA=C:\Users\litan\AppData\Roaming, CommonProgramFiles=C:\Program Files\Common Files, Path=C:\ProgramData\Oracle\Java\javapath;D:\java\oracle\product\11.2.0\dbhome_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\lenovo\easyplussdk\bin;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.2 & MySQL Utilities 1.5.2 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.2 & MySQL Utilities 1.5.2 1.5\Doctrine extensions for PHP\;D:\java\java1.8\jdk1.8\bin;JAVA_HOME%\jre\bin;D:\java\Z_review\apache-tomcat-7.0.67\bin;D:\我的软件;办公软;\svnServer\bin;%ma;en_home%\bin;D:\我的软件\数据库\putty\;C:\Pro;ram Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;";D:\我的软件\专业软件\zookeeper\zookeeper-3.4.9/bin; D:\我的软件\专业软件\zookeeper\zookeeper-3.4.9/conf";D:\java\java1.8\jdk1.8\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;D:\java软件安装资源汇总\maven建项目\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin;D:\protobufc\bin;C:\Users\litan\AppData\Local\Microsoft\WindowsApps;D:\java软件安装资源汇总\2017-6-25\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin;, OS=Windows_NT, COMPUTERNAME=LITAN, CATALINA_HOME=D:\java\Z_review\apache-tomcat-7.0.67, PROCESSOR_REVISION=3d04, CLASSPATH=.;D:\java\java1.8\jdk1.8\lib;D:\java\java1.8\jdk1.8\lib\tools.jar, CommonProgramW6432=C:\Program Files\Common Files, ComSpec=C:\WINDOWS\system32\cmd.exe, SystemRoot=C:\WINDOWS, TEMP=C:\Users\litan\AppData\Local\Temp, HOMEDRIVE=C:, USERPROFILE=C:\Users\litan, TMP=C:\Users\litan\AppData\Local\Temp, easyplussdk="C:\Program Files (x86)\Common Files\lenovo\easyplussdk\bin", CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files, NUMBER_OF_PROCESSORS=4}}]
13:13:24.513 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Resolved classpath location [com/zxy/demo/] to resources [URL [file:/D:/worksheet/elk/target/test-classes/com/zxy/demo/], URL [file:/D:/worksheet/elk/target/classes/com/zxy/demo/]]
13:13:24.514 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Looking for matching resources in directory tree [D:\worksheet\elk\target\test-classes\com\zxy\demo]
13:13:24.514 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Searching directory [D:\worksheet\elk\target\test-classes\com\zxy\demo] for files matching pattern [D:/worksheet/elk/target/test-classes/com/zxy/demo/*.class]
13:13:24.518 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Looking for matching resources in directory tree [D:\worksheet\elk\target\classes\com\zxy\demo]
13:13:24.518 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Searching directory [D:\worksheet\elk\target\classes\com\zxy\demo] for files matching pattern [D:/worksheet/elk/target/classes/com/zxy/demo/*.class]
13:13:24.519 [main] DEBUG org.springframework.core.io.support.PathMatchingResourcePatternResolver - Resolved location pattern [classpath*:com/zxy/demo/*.class] to resources [file [D:\worksheet\elk\target\test-classes\com\zxy\demo\ElkApplicationTests.class], file [D:\worksheet\elk\target\classes\com\zxy\demo\ElkApplication.class]]
13:13:24.585 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [D:\worksheet\elk\target\classes\com\zxy\demo\ElkApplication.class]
13:13:24.587 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration com.zxy.demo.ElkApplication for test class com.zxy.demo.ElkApplicationTests
13:13:24.772 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.zxy.demo.ElkApplicationTests]: using defaults.
13:13:24.774 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
13:13:24.797 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@79924b, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@7b9a4292, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@4a94ee4, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@4cc451f2, org.springframework.test.context.support.DirtiesContextTestExecutionListener@6379eb, org.springframework.test.context.transaction.TransactionalTestExecutionListener@294425a7, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@67d48005, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@9f116cc, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@12468a38, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@1aa7ecca, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@59309333, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@5876a9af]
13:13:24.799 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.zxy.demo.ElkApplicationTests]
13:13:24.799 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.zxy.demo.ElkApplicationTests]
13:13:24.801 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.zxy.demo.ElkApplicationTests]
13:13:24.801 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.zxy.demo.ElkApplicationTests]
13:13:24.821 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.zxy.demo.ElkApplicationTests]
13:13:24.821 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.zxy.demo.ElkApplicationTests]
13:13:24.823 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.zxy.demo.ElkApplicationTests]
13:13:24.823 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.zxy.demo.ElkApplicationTests]
13:13:24.824 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.zxy.demo.ElkApplicationTests]
13:13:24.825 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.zxy.demo.ElkApplicationTests]
13:13:24.834 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@223191a6 testClass = ElkApplicationTests, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@49139829 testClass = ElkApplicationTests, locations = '{}', classes = '{class com.zxy.demo.ElkApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@15d0c81b, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@17579e0f, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@7a765367, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@3234e239], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true]], class annotated with @DirtiesContext [false] with mode [null].
13:13:24.835 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.zxy.demo.ElkApplicationTests]
13:13:24.835 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.zxy.demo.ElkApplicationTests]
13:13:24.866 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding PropertySource 'systemProperties' with lowest search precedence
13:13:24.866 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding PropertySource 'systemEnvironment' with lowest search precedence
13:13:24.867 [main] DEBUG org.springframework.core.env.StandardEnvironment - Initialized StandardEnvironment with PropertySources [MapPropertySource@331994761 {name='systemProperties', properties={java.runtime.name=Java(TM) SE Runtime Environment, sun.boot.library.path=D:\java\java1.8\jre1.8\bin, java.vm.version=25.161-b12, java.vm.vendor=Oracle Corporation, java.vendor.url=http://java.oracle.com/, path.separator=;, java.vm.name=Java HotSpot(TM) 64-Bit Server VM, file.encoding.pkg=sun.io, user.country=CN, user.script=, sun.java.launcher=SUN_STANDARD, sun.os.patch.level=, java.vm.specification.name=Java Virtual Machine Specification, user.dir=D:\worksheet\elk, java.runtime.version=1.8.0_161-b12, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.endorsed.dirs=D:\java\java1.8\jre1.8\lib\endorsed, os.arch=amd64, java.io.tmpdir=C:\Users\litan\AppData\Local\Temp\, line.separator=
, java.vm.specification.vendor=Oracle Corporation, user.variant=, os.name=Windows 10, sun.jnu.encoding=GBK, java.library.path=D:\java\java1.8\jre1.8\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\ProgramData\Oracle\Java\javapath;D:\java\oracle\product\11.2.0\dbhome_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\lenovo\easyplussdk\bin;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.2 & MySQL Utilities 1.5.2 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.2 & MySQL Utilities 1.5.2 1.5\Doctrine extensions for PHP\;D:\java\java1.8\jdk1.8\bin;JAVA_HOME%\jre\bin;D:\java\Z_review\apache-tomcat-7.0.67\bin;D:\我的软件;办公软;\svnServer\bin;%ma;en_home%\bin;D:\我的软件\数据库\putty\;C:\Pro;ram Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;";D:\我的软件\专业软件\zookeeper\zookeeper-3.4.9/bin; D:\我的软件\专业软件\zookeeper\zookeeper-3.4.9/conf";D:\java\java1.8\jdk1.8\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;D:\java软件安装资源汇总\maven建项目\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin;D:\protobufc\bin;C:\Users\litan\AppData\Local\Microsoft\WindowsApps;D:\java软件安装资源汇总\2017-6-25\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin;;., java.specification.name=Java Platform API Specification, java.class.version=52.0, sun.management.compiler=HotSpot 64-Bit Tiered Compilers, os.version=10.0, user.home=C:\Users\litan, user.timezone=Asia/Shanghai, java.awt.printerjob=sun.awt.windows.WPrinterJob, file.encoding=UTF-8, java.specification.version=1.8, java.class.path=D:\worksheet\elk\target\test-classes;D:\worksheet\elk\target\classes;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.0.5.RELEASE\spring-boot-starter-web-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-starter\2.0.5.RELEASE\spring-boot-starter-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot\2.0.5.RELEASE\spring-boot-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.0.5.RELEASE\spring-boot-autoconfigure-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.0.5.RELEASE\spring-boot-starter-logging-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\litan\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\litan\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.10.0\log4j-to-slf4j-2.10.0.jar;C:\Users\litan\.m2\repository\org\apache\logging\log4j\log4j-api\2.10.0\log4j-api-2.10.0.jar;C:\Users\litan\.m2\repository\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;C:\Users\litan\.m2\repository\javax\annotation\javax.annotation-api\1.3.2\javax.annotation-api-1.3.2.jar;C:\Users\litan\.m2\repository\org\yaml\snakeyaml\1.19\snakeyaml-1.19.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.0.5.RELEASE\spring-boot-starter-json-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.9.6\jackson-databind-2.9.6.jar;C:\Users\litan\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.9.0\jackson-annotations-2.9.0.jar;C:\Users\litan\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.9.6\jackson-core-2.9.6.jar;C:\Users\litan\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.9.6\jackson-datatype-jdk8-2.9.6.jar;C:\Users\litan\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.9.6\jackson-datatype-jsr310-2.9.6.jar;C:\Users\litan\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.9.6\jackson-module-parameter-names-2.9.6.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.0.5.RELEASE\spring-boot-starter-tomcat-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\8.5.34\tomcat-embed-core-8.5.34.jar;C:\Users\litan\.m2\repository\org\apache\tomcat\embed\tomcat-embed-el\8.5.34\tomcat-embed-el-8.5.34.jar;C:\Users\litan\.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.34\tomcat-embed-websocket-8.5.34.jar;C:\Users\litan\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.12.Final\hibernate-validator-6.0.12.Final.jar;C:\Users\litan\.m2\repository\javax\validation\validation-api\2.0.1.Final\validation-api-2.0.1.Final.jar;C:\Users\litan\.m2\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;C:\Users\litan\.m2\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;C:\Users\litan\.m2\repository\org\springframework\spring-web\5.0.9.RELEASE\spring-web-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\spring-beans\5.0.9.RELEASE\spring-beans-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\spring-webmvc\5.0.9.RELEASE\spring-webmvc-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\spring-aop\5.0.9.RELEASE\spring-aop-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\spring-context\5.0.9.RELEASE\spring-context-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\spring-expression\5.0.9.RELEASE\spring-expression-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-starter\1.3.2\mybatis-spring-boot-starter-1.3.2.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.0.5.RELEASE\spring-boot-starter-jdbc-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\com\zaxxer\HikariCP\2.7.9\HikariCP-2.7.9.jar;C:\Users\litan\.m2\repository\org\springframework\spring-jdbc\5.0.9.RELEASE\spring-jdbc-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\spring-tx\5.0.9.RELEASE\spring-tx-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\1.3.2\mybatis-spring-boot-autoconfigure-1.3.2.jar;C:\Users\litan\.m2\repository\org\mybatis\mybatis\3.4.6\mybatis-3.4.6.jar;C:\Users\litan\.m2\repository\org\mybatis\mybatis-spring\1.3.2\mybatis-spring-1.3.2.jar;C:\Users\litan\.m2\repository\mysql\mysql-connector-java\5.1.47\mysql-connector-java-5.1.47.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-starter-test\2.0.5.RELEASE\spring-boot-starter-test-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-test\2.0.5.RELEASE\spring-boot-test-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\boot\spring-boot-test-autoconfigure\2.0.5.RELEASE\spring-boot-test-autoconfigure-2.0.5.RELEASE.jar;C:\Users\litan\.m2\repository\com\jayway\jsonpath\json-path\2.4.0\json-path-2.4.0.jar;C:\Users\litan\.m2\repository\net\minidev\json-smart\2.3\json-smart-2.3.jar;C:\Users\litan\.m2\repository\net\minidev\accessors-smart\1.2\accessors-smart-1.2.jar;C:\Users\litan\.m2\repository\org\ow2\asm\asm\5.0.4\asm-5.0.4.jar;C:\Users\litan\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\litan\.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\litan\.m2\repository\org\assertj\assertj-core\3.9.1\assertj-core-3.9.1.jar;C:\Users\litan\.m2\repository\org\mockito\mockito-core\2.15.0\mockito-core-2.15.0.jar;C:\Users\litan\.m2\repository\net\bytebuddy\byte-buddy\1.7.11\byte-buddy-1.7.11.jar;C:\Users\litan\.m2\repository\net\bytebuddy\byte-buddy-agent\1.7.11\byte-buddy-agent-1.7.11.jar;C:\Users\litan\.m2\repository\org\objenesis\objenesis\2.6\objenesis-2.6.jar;C:\Users\litan\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\litan\.m2\repository\org\hamcrest\hamcrest-library\1.3\hamcrest-library-1.3.jar;C:\Users\litan\.m2\repository\org\skyscreamer\jsonassert\1.5.0\jsonassert-1.5.0.jar;C:\Users\litan\.m2\repository\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;C:\Users\litan\.m2\repository\org\springframework\spring-core\5.0.9.RELEASE\spring-core-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\spring-jcl\5.0.9.RELEASE\spring-jcl-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\springframework\spring-test\5.0.9.RELEASE\spring-test-5.0.9.RELEASE.jar;C:\Users\litan\.m2\repository\org\xmlunit\xmlunit-core\2.5.1\xmlunit-core-2.5.1.jar;D:\javaDevlepTool\eclipse4.8\eclipse\configuration\org.eclipse.osgi\416\0\.cp;D:\javaDevlepTool\eclipse4.8\eclipse\configuration\org.eclipse.osgi\415\0\.cp, user.name=litan, java.vm.specification.version=1.8, sun.java.command=org.eclipse.jdt.internal.junit.runner.RemoteTestRunner -version 3 -port 52767 -testLoaderClass org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader -loaderpluginname org.eclipse.jdt.junit4.runtime -test com.zxy.demo.ElkApplicationTests:testLog, java.home=D:\java\java1.8\jre1.8, sun.arch.data.model=64, user.language=zh, java.specification.vendor=Oracle Corporation, awt.toolkit=sun.awt.windows.WToolkit, java.vm.info=mixed mode, java.version=1.8.0_161, java.ext.dirs=D:\java\java1.8\jre1.8\lib\ext;C:\WINDOWS\Sun\Java\lib\ext, sun.boot.class.path=D:\java\java1.8\jre1.8\lib\resources.jar;D:\java\java1.8\jre1.8\lib\rt.jar;D:\java\java1.8\jre1.8\lib\sunrsasign.jar;D:\java\java1.8\jre1.8\lib\jsse.jar;D:\java\java1.8\jre1.8\lib\jce.jar;D:\java\java1.8\jre1.8\lib\charsets.jar;D:\java\java1.8\jre1.8\lib\jfr.jar;D:\java\java1.8\jre1.8\classes, java.vendor=Oracle Corporation, file.separator=\, java.vendor.url.bug=http://bugreport.sun.com/bugreport/, sun.io.unicode.encoding=UnicodeLittle, sun.cpu.endian=little, sun.desktop=windows, sun.cpu.isalist=amd64}}, SystemEnvironmentPropertySource@928294079 {name='systemEnvironment', properties={configsetroot=C:\WINDOWS\ConfigSetRoot, USERDOMAIN_ROAMINGPROFILE=LITAN, PROCESSOR_LEVEL=6, SESSIONNAME=Console, ALLUSERSPROFILE=C:\ProgramData, PROCESSOR_ARCHITECTURE=AMD64, PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;D:\我的软件\办公软件\svnServer\PowerShellModules, SystemDrive=C:, MAVEN_HOME=D:\java软件安装资源汇总\maven建项目\apache-maven-3.3.9-bin\apache-maven-3.3.9, USERNAME=litan, ProgramFiles(x86)=C:\Program Files (x86), VISUALSVN_SERVER=D:\我的软件\办公软件\svnServer\, FPS_BROWSER_USER_PROFILE_STRING=Default, PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC, DriverData=C:\Windows\System32\Drivers\DriverData, ProgramData=C:\ProgramData, ProgramW6432=C:\Program Files, HOMEPATH=\Users\litan, PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 61 Stepping 4, GenuineIntel, ProgramFiles=C:\Program Files, PUBLIC=C:\Users\Public, windir=C:\WINDOWS, =::=::\, ZOOKEEPER_HOME=D:\我的软件\专业软件\zookeeper\zookeeper-3.4.9, LOCALAPPDATA=C:\Users\litan\AppData\Local, USERDOMAIN=LITAN, FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer, LOGONSERVER=\\LITAN, JAVA_HOME=D:\java\java1.8\jdk1.8, ERLANG_HOME=D:\topband\soft\RabbitMQ\erl7.1, OneDrive=C:\Users\litan\OneDrive, =C:=C:\, APPDATA=C:\Users\litan\AppData\Roaming, CommonProgramFiles=C:\Program Files\Common Files, Path=C:\ProgramData\Oracle\Java\javapath;D:\java\oracle\product\11.2.0\dbhome_1\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\lenovo\easyplussdk\bin;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.2 & MySQL Utilities 1.5.2 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.2 & MySQL Utilities 1.5.2 1.5\Doctrine extensions for PHP\;D:\java\java1.8\jdk1.8\bin;JAVA_HOME%\jre\bin;D:\java\Z_review\apache-tomcat-7.0.67\bin;D:\我的软件;办公软;\svnServer\bin;%ma;en_home%\bin;D:\我的软件\数据库\putty\;C:\Pro;ram Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;";D:\我的软件\专业软件\zookeeper\zookeeper-3.4.9/bin; D:\我的软件\专业软件\zookeeper\zookeeper-3.4.9/conf";D:\java\java1.8\jdk1.8\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;C:\WINDOWS\System32\OpenSSH\;D:\java软件安装资源汇总\maven建项目\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin;D:\protobufc\bin;C:\Users\litan\AppData\Local\Microsoft\WindowsApps;D:\java软件安装资源汇总\2017-6-25\apache-maven-3.3.9-bin\apache-maven-3.3.9\bin;, OS=Windows_NT, COMPUTERNAME=LITAN, CATALINA_HOME=D:\java\Z_review\apache-tomcat-7.0.67, PROCESSOR_REVISION=3d04, CLASSPATH=.;D:\java\java1.8\jdk1.8\lib;D:\java\java1.8\jdk1.8\lib\tools.jar, CommonProgramW6432=C:\Program Files\Common Files, ComSpec=C:\WINDOWS\system32\cmd.exe, SystemRoot=C:\WINDOWS, TEMP=C:\Users\litan\AppData\Local\Temp, HOMEDRIVE=C:, USERPROFILE=C:\Users\litan, TMP=C:\Users\litan\AppData\Local\Temp, easyplussdk="C:\Program Files (x86)\Common Files\lenovo\easyplussdk\bin", CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files, NUMBER_OF_PROCESSORS=4}}]
13:13:24.868 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true, server.port=-1}
13:13:24.868 [main] DEBUG org.springframework.core.env.StandardEnvironment - Adding PropertySource 'Inlined Test Properties' with highest search precedence
13:13:25,330 |-WARN in Logger[org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator] - No appenders present in context [default] for logger [org.hibernate.validator.messageinterpolation.ResourceBundleMessageInterpolator].
13:13:25,359 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Will scan for changes in [file:/D:/worksheet/elk/target/classes/logback-spring.xml]
13:13:25,359 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Setting ReconfigureOnChangeTask scanning period to 1 minutes
13:13:25,364 |-INFO in ch.qos.logback.classic.joran.action.ContextNameAction - Setting logger context name as [elk]
13:13:25,365 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
13:13:25,365 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
13:13:25,396 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
13:13:25,399 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE]
13:13:25,412 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@459718907 - No compression will be used
13:13:25,414 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@459718907 - Will use the pattern d://%d{yyyy-MM-dd}/error-log.log for the active file
13:13:25,420 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date pattern is 'yyyy-MM-dd' from file name pattern 'd://%d{yyyy-MM-dd}/error-log.log'.
13:13:25,420 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-over at midnight.
13:13:25,424 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting initial period to Mon Oct 01 12:39:50 CST 2018
13:13:25,429 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Active log file name: d://elk.log
13:13:25,429 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - File property is set to [d://elk.log]
13:13:25,431 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.apache.ibatis] to TRACE
13:13:25,432 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@2f67a4d3 - Propagating TRACE level on Logger[com.apache.ibatis] onto the JUL framework
13:13:25,432 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [java.sql.Connection] to DEBUG
13:13:25,432 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@2f67a4d3 - Propagating DEBUG level on Logger[java.sql.Connection] onto the JUL framework
13:13:25,433 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [java.sql.Statement] to DEBUG
13:13:25,433 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@2f67a4d3 - Propagating DEBUG level on Logger[java.sql.Statement] onto the JUL framework
13:13:25,433 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [java.sql.PreparedStatement] to DEBUG
13:13:25,433 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@2f67a4d3 - Propagating DEBUG level on Logger[java.sql.PreparedStatement] onto the JUL framework
13:13:25,433 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
13:13:25,433 |-INFO in ch.qos.logback.classic.jul.LevelChangePropagator@2f67a4d3 - Propagating INFO level on Logger[ROOT] onto the JUL framework
13:13:25,433 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
13:13:25,433 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE] to Logger[ROOT]
13:13:25,433 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
13:13:25,434 |-INFO in org.springframework.boot.logging.logback.SpringBootJoranConfigurator@642a7222 - Registering current configuration as safe fallback point . ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.5.RELEASE) 2018-10-01 13:13:25.640 {main} INFO com.zxy.demo.ElkApplicationTests =======> Starting ElkApplicationTests on litan with PID 14856 (started by litan in D:\worksheet\elk)
2018-10-01 13:13:25.642 {main} INFO com.zxy.demo.ElkApplicationTests =======> No active profile set, falling back to default profiles: default
2018-10-01 13:13:25.691 {main} INFO o.s.w.context.support.GenericWebApplicationContext =======> Refreshing org.springframework.web.context.support.GenericWebApplicationContext@78fa769e: startup date [Mon Oct 01 13:13:25 CST 2018]; root of context hierarchy
2018-10-01 13:13:26.666 {main} WARN org.mybatis.spring.mapper.ClassPathMapperScanner =======> No MyBatis mapper was found in '[com.zxy.demo]' package. Please check your configuration.
2018-10-01 13:13:27.814 {main} INFO o.s.web.servlet.handler.SimpleUrlHandlerMapping =======> Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-10-01 13:13:28.153 {main} INFO o.s.w.s.m.m.a.RequestMappingHandlerAdapter =======> Looking for @ControllerAdvice: org.springframework.web.context.support.GenericWebApplicationContext@78fa769e: startup date [Mon Oct 01 13:13:25 CST 2018]; root of context hierarchy
2018-10-01 13:13:28.262 {main} INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping =======> Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-10-01 13:13:28.265 {main} INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping =======> Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-10-01 13:13:28.312 {main} INFO o.s.web.servlet.handler.SimpleUrlHandlerMapping =======> Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-10-01 13:13:28.313 {main} INFO o.s.web.servlet.handler.SimpleUrlHandlerMapping =======> Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-10-01 13:13:28.911 {main} INFO com.zxy.demo.ElkApplicationTests =======> Started ElkApplicationTests in 4.026 seconds (JVM running for 5.307)
2018-10-01 13:13:29.392 {main} INFO com.zxy.demo.ElkApplicationTests =======> message:this is first logger!
2018-10-01 13:13:29.401 {Thread-2} INFO o.s.w.context.support.GenericWebApplicationContext =======> Closing org.springframework.web.context.support.GenericWebApplicationContext@78fa769e: startup date [Mon Oct 01 13:13:25 CST 2018]; root of context hierarchy
d:/elk.log也有日志打印了,OK!
接下来,我们来整合elk,elk在上一篇章中已经搭建完成,我们这里需要将日志输出到logstash存储到elasticsearch中,通过kibana进行显示即可。
在工程中添加logstash-logback的依赖
<!-- https://mvnrepository.com/artifact/net.logstash.logback/logstash-logback-encoder -->
<dependency>
<groupId>net.logstash.logback</groupId>
<artifactId>logstash-logback-encoder</artifactId>
<version>4.11</version>
</dependency>
写一个logstash的配置文件,启动logstash时候采用该配置文件进行启动。
配置文件如下:
input {
tcp {
##host:port就是上面appender中的 destination,这里其实把logstash作为服务,开启9601端口接收logback发出的消息
host => "192.168.10.194"
port => 9601
#模式选择为server
mode => "server"
tags => ["tags"] ##格式json
codec => json_lines
} } output {
elasticsearch {
#ES地址
hosts => "192.168.10.194:9200"
#指定索引名字,不适用默认的,用来区分各个项目
index => "%{[appname]}-%{+YYYY.MM.dd}"
}
stdout { codec => rubydebug}
}
在用户端启动elasticsearch,root端分别启动kibana和logstash,
在test单元测试中添加一句日志以示区别:
package com.zxy.demo; import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class)
@SpringBootTest
public class ElkApplicationTests {
private Logger logger = LoggerFactory.getLogger(this.getClass()); @Test
public void contextLoads() {
}
@Test
public void testLog() {
logger.info("message:this is first logger!");
logger.info("msg:[********upload to logstash and elasticsearch,kibana view!!!********]");
}
}
然后运行springboot项目,打印日志在centos的控制台可见
kibana上也能看到日志已经过来了
把检索的也贴出来吧
总结,这里logback和elk的整合主要有三步:
一、添加logback-logstash的整合依赖包
二、编写logstash的配置文件,这个笔者认为比较灵活,如果对其语法不甚了解会比较难办
三、就是配置logback.xml了把输入的目标写好就OK了
springboot整合logback集成elk实现日志的汇总、分析、统计和检索功能的更多相关文章
- springboot 整合logback(有全套的日志配置文件)
logback介绍:基于Log4j基础上大量改良,不能单独使用,推荐配合日志框架SLF4J来使用,可以和springboot很好的整合,也是springboot默认推荐的. 1.在resources ...
- springboot(二).springboot整合logback用于日志输出
springboot整合logback用于日志输出 我们项目的基本框架已经完成,http请求已经可以访问,现在给我们的框架添加日志记录的功能并能将每天的记录记录到文件中去 在这里,我们使用logbac ...
- SpringBoot整合Logback日志框架配置全解析
目录 本篇要点 一.Logback日志框架介绍 二.SpringBoot与Logback 1.默认日志格式 2.控制台输出 3.文件输出 4.日志级别 5.日志组 6.自定义log配置 三.logba ...
- springboot2整合logback.xml动态修改日志打印级别
今天找bug烦到了,生产上的日志级别不能修改,非常不利于排查问题,于是想到了动态修改日志打印级别, 因为上一周把项目升级成springboot2,并且使用logback.xml管理日志打印,所以修改也 ...
- springboot 整合logback
日志包使用的是springboot内置的日志包,所以我们不许要再专门导入日志包 1.logback-spring.xml配置 <?xml version="1.0" enco ...
- springboot aop + logback + 统一异常处理 打印日志
1.src/resources路径下新建logback.xml 控制台彩色日志打印 info日志和异常日志分不同文件存储 每天自动生成日志 结合myibatis方便日志打印(debug模式) < ...
- SpringBoot整合+logback日志配置
本次演示的代码结构如下,基于maven,整合SpringBoot.Spring.Mybaits的SSM框架.同时测试logback日志框架的使用及配置. 1.创建maven工程,修改pom.xml文件 ...
- SpringBoot整合logback日志框架
在resource下创建一个名称为 logback-spring.xml文件 <configuration> <!--日志文件夹存放的名称--> <contextName ...
- SpringBoot 整合 Logback
Logback is intended as a successor to the popular log4j project, picking up where log4j leaves off.L ...
随机推荐
- JAVAWeb问题总结(持续更新)
1.在JSP页面头部,出现如下错误: 错误文本: Multiple annotations found at this line: - The superclass "javax.servl ...
- idea提交项目到码云
1.安装Git 2.在码云上创建项目 3.在IDEA提交项目到码云
- 虚拟机与ubuntu系统的安装与基础操作
1.虚拟机的下载: 常见的虚拟机软件有:VMware VirtuaIBOX Virtual PC 等. 这里主要介绍VMware ,VMware目前已经有很多个版本,可以根据个人情况进行选择.安 ...
- Topcoder SRM 590 Fox And City
Link 注意到原图给的是一个无向连通图. 如果在原图中两点之间有一条无向边,那么这两点到\(1\)的距离之差不大于\(1\). 这个命题的正确性是显然的,我们考虑它的逆命题: 给定每个点到\(1\) ...
- 吴裕雄 Bootstrap 前端框架开发——Bootstrap 排版:使段落突出显示
<!DOCTYPE html> <html> <head> <title>菜鸟教程(runoob.com)</title> <meta ...
- 关于c++的头文件和变量声明
写再最前面:摘录于柳神的笔记: C++的头⽂件⼀般是没有像C语⾔的 .h 这样的扩展后缀的,⼀般情况下C语⾔⾥⾯的头⽂件去掉 .h 然 后在前⾯加个 c 就可以继续在C++⽂件中使⽤C语⾔头⽂件中 ...
- spring mvc注解之@RequestBody和@RequestParm
@RequestBody http://localhost:8080/user/login { "username":"jack", "passwar ...
- kafka 副本同步细节
图片来源:咕泡学院
- Jquery 分页案例
Jquery 分页案例 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /& ...
- 【PAT甲级】1030 Travel Plan (30 分)(SPFA,DFS)
题意: 输入N,M,S,D(N,M<=500,0<S,D<N),接下来M行输入一条边的起点,终点,通过时间和通过花费.求花费最小的最短路,输入这条路径包含起点终点,通过时间和通过花费 ...