- 浏览: 60593 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (93)
- java (3)
- ios (9)
- wp (15)
- android (0)
- js (1)
- 服务器 (0)
- db (0)
- linux (1)
- python (0)
- xcode (0)
- ide (2)
- maven (0)
- spring (0)
- sql (0)
- 第三方 (1)
- nexus (0)
- nginx (11)
- tomcat (0)
- jenkins (0)
- zookeeper (1)
- git (1)
- svn (0)
- uml (0)
- redis (4)
- activemq (1)
- flume (0)
- kafka (0)
- mysql (1)
- memcached (0)
- mybatis (0)
- mac (0)
- mongo (1)
- docker (6)
- cache (0)
- jvm (0)
- markdown (0)
- springboot (24)
- mycat (3)
- LTS (3)
- 运维 (0)
- opts (1)
- netty (1)
- tcc (0)
- ffmpeg (2)
- 直播 (6)
- cxf (0)
- nodejs (0)
- storm (0)
- elasticjob (0)
- php (0)
最新评论
====================================================
logback.xml
resource下添加xml文件
====================================================
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60" debug="false">
<contextName>movikr-svc-activity</contextName>
<property name="file_path" value="logs/movikr-svc-activity"/>
<property name="date_pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"/>
<property name="max_history" value="7"/>
<property name="file_size" value="10MB"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder charset="UTF-8">
<pattern>${date_pattern}</pattern>
</encoder>
</appender>
<appender name="APP" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${file_path}/app.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${file_path}/app.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxHistory>${max_history}</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${file_size}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder charset="UTF-8">
<pattern>${date_pattern}</pattern>
</encoder>
</appender>
<appender name="REQUEST" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${file_path}/request.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${file_path}/request.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxHistory>${max_history}</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${file_size}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder charset="UTF-8">
<pattern>${date_pattern}</pattern>
</encoder>
</appender>
<appender name="DUBBO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${file_path}/dubbo.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${file_path}/dubbo.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxHistory>${max_history}</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${file_size}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder charset="UTF-8">
<pattern>${date_pattern}</pattern>
</encoder>
</appender>
<appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${file_path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${file_path}/error.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxHistory>${max_history}</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${file_size}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder charset="UTF-8">
<pattern>${date_pattern}</pattern>
</encoder>
</appender>
<logger name="org.spring.springboot" level="DEBUG" additivity="false">
<appender-ref ref="APP"/>
<!--在dev环境下console输出-->
<springProfile name="dev">
<appender-ref ref="CONSOLE"/>
</springProfile>
</logger>
<logger name="com.movikr.v2.utils.web.UtilURLConn" level="INFO" additivity="false">
<appender-ref ref="REQUEST" />
</logger>
<logger name="org.springframework">
<level value="ERROR" />
</logger>
<logger name="org.apache">
<level value="ERROR" />
</logger>
<logger name="org.mybatis">
<level value="ERROR" />
</logger>
<logger name="com.alibaba.dubbo" level="WARN">
<appender-ref ref="DUBBO"/>
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="ERROR" level="INFO" additivity="false">
<appender-ref ref="ERROR"/>
<appender-ref ref="CONSOLE"/>
</logger>
</configuration>
====================================================
protected static Logger logger = LoggerFactory.getLogger(HelloWorldController.class);
logger.debug(homeProperties.getCity());
logback.xml
resource下添加xml文件
====================================================
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60" debug="false">
<contextName>movikr-svc-activity</contextName>
<property name="file_path" value="logs/movikr-svc-activity"/>
<property name="date_pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n"/>
<property name="max_history" value="7"/>
<property name="file_size" value="10MB"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder charset="UTF-8">
<pattern>${date_pattern}</pattern>
</encoder>
</appender>
<appender name="APP" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${file_path}/app.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${file_path}/app.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxHistory>${max_history}</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${file_size}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder charset="UTF-8">
<pattern>${date_pattern}</pattern>
</encoder>
</appender>
<appender name="REQUEST" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${file_path}/request.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${file_path}/request.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxHistory>${max_history}</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${file_size}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder charset="UTF-8">
<pattern>${date_pattern}</pattern>
</encoder>
</appender>
<appender name="DUBBO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${file_path}/dubbo.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${file_path}/dubbo.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxHistory>${max_history}</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${file_size}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder charset="UTF-8">
<pattern>${date_pattern}</pattern>
</encoder>
</appender>
<appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${file_path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${file_path}/error.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxHistory>${max_history}</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${file_size}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder charset="UTF-8">
<pattern>${date_pattern}</pattern>
</encoder>
</appender>
<logger name="org.spring.springboot" level="DEBUG" additivity="false">
<appender-ref ref="APP"/>
<!--在dev环境下console输出-->
<springProfile name="dev">
<appender-ref ref="CONSOLE"/>
</springProfile>
</logger>
<logger name="com.movikr.v2.utils.web.UtilURLConn" level="INFO" additivity="false">
<appender-ref ref="REQUEST" />
</logger>
<logger name="org.springframework">
<level value="ERROR" />
</logger>
<logger name="org.apache">
<level value="ERROR" />
</logger>
<logger name="org.mybatis">
<level value="ERROR" />
</logger>
<logger name="com.alibaba.dubbo" level="WARN">
<appender-ref ref="DUBBO"/>
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="ERROR" level="INFO" additivity="false">
<appender-ref ref="ERROR"/>
<appender-ref ref="CONSOLE"/>
</logger>
</configuration>
====================================================
protected static Logger logger = LoggerFactory.getLogger(HelloWorldController.class);
logger.debug(homeProperties.getCity());
发表评论
-
springboot:condition
2017-07-26 11:10 364public class LinuxCondition imp ... -
springboot:tomcat启动
2017-07-20 15:02 9221.在pom.xml里设置 <packaging> ... -
springboot:shiro
2017-07-13 15:52 967第一次学习系统学习shiro 并将shiro集成到sprin ... -
springboot:upload
2017-07-06 10:25 754FileUploadConfiguration.java == ... -
springboot:servlet
2017-07-06 10:17 509Application.java ============== ... -
springboot:freemarker
2017-07-05 17:33 572pom.xml ======================= ... -
springboot:task
2017-07-05 12:11 443TaskPool.java ================= ... -
springboot:热部署
2017-07-05 11:23 359pom.xml: ====================== ... -
springboot:注解
2017-07-04 11:36 632@EnableAutoConfiguration注解 excl ... -
springboot:server属性配置
2017-07-04 10:05 774server配置 ====================== ... -
springboot:memcached
2017-07-03 17:23 948pom.xml ======================= ... -
springboot:health
2017-07-03 16:43 401<dependency> ... -
springboot:mongodb
2017-07-03 15:38 1569pom.xml ======================= ... -
springboot:quartz集群
2017-07-02 20:40 1006pom.xml ======================= ... -
springboot:ControllerAdvice
2017-07-02 14:09 375全局异常拦截 //@ControllerAdvice(anno ... -
springboot:dubbo
2017-07-02 10:40 503server: ======================= ... -
springboot:amq
2017-07-01 22:20 472pom.xml ======================= ... -
springboot:redis(jedis)
2017-07-01 14:10 908application.properties ======== ... -
springboot:mybatis&druid&pagehelper
2017-07-01 13:35 414=============================== ... -
springboot:interceptor
2017-06-30 14:04 639IncpConfig.java 增加拦截器config 继承W ...
相关推荐
Logback是Spring Boot默认的日志实现,它提供了一种高效且灵活的日志记录方式。本文将介绍如何利用Spring Boot和Logback来实现一个简单的链路追踪功能,以便更好地跟踪用户在系统中的操作。 链路追踪(Traceability...
Spring Boot与Logback源码解读涉及了Spring Boot框架在启动过程中如何与Logback日志系统集成,以及Logback是如何进行初始化和配置的。下面将详细解读Logback和Spring Boot的相关知识点。 ### Logback初始化过程 ...
springboot-logback日志文件配置
Spring Boot 使用 Logback 输出日志文件 Spring Boot 提供了多种日志记录工具,包括 Logback、Log4J2 和 Java Util Logging。默认情况下,Spring Boot 使用 Logback 作为日志记录工具。在日志记录过程中,我们可以...
本示例"clickhouse+springboot+logback的Demo"是一个基于大数据项目的模板,它整合了ClickHouse数据库、SpringBoot框架以及Logback日志系统。让我们深入探讨这三个核心组件以及它们如何协同工作。 首先,ClickHouse...
本项目"SpringBoot-logback"正是关于如何在SpringBoot应用中整合Logback,实现不同级别的日志(info、debug、error、warn)区分以及每日日志自动归档。 首先,让我们深入了解SpringBoot与Logback的集成。SpringBoot...
springboot整合logback配置文件
SpringBoot中logback日志保存到mongoDB的方法 SpringBoot中logback日志保存到mongoDB的方法是指在SpringBoot项目中使用logback日志框架将日志保存到mongoDB数据库中的方法。logback是 SpringBoot默认集成的日志框架...
SpringBoot 配置 Logback 日志管理过程详解 本文将详细介绍 SpringBoot 配置 Logback 日志管理过程的知识点,通过示例代码,帮助读者更好地理解Logback日志管理在 SpringBoot 中的应用。 Logback 简介 Logback 是...
Logback是Spring Boot默认的日志系统,它高效且可配置,适用于各种日志需求。本篇文章将详细介绍如何配置Spring Boot中的Logback以实现定制化的日志记录。 首先,我们需要了解Logback的基本概念。Logback是由Ceki G...
当使用logback作为日志框架时,通常我们会将配置文件放在`src/main/resources`目录下,命名为`logback-spring.xml`,这是因为Spring Boot默认支持`logback-spring.xml`,它能与Spring的自动配置机制集成。...
implementation 'ch.qos.logback:logback-classic' ``` 2. **配置Logback** Spring Boot默认使用`src/main/resources/logback-spring.xml`或`logback.xml`作为Logback的配置文件。如果希望日志保存到文件,我们...
在“SpringBoot+tk.Mybatis整合+yml配置+logback配置”这个主题中,我们将探讨以下几个关键知识点: 1. **SpringBoot整合tk.Mybatis**: tk.Mybatis 是 Mybatis 的一个扩展,提供了很多实用功能,如:动态 SQL、...
springboot1.5.6.RELEASE,简单的springboot项目仅做了查询功能。。。懒死了,没办法^_^ 本项目为jar。。可直接运行,如果想改成war,如下操作: 第一步:pom.xml中导入tomcat依赖 <groupId>org.springframework....
用于日志配置
《SpringBoot与Logback整合的基础实践》 在Java开发领域,SpringBoot因其便捷的配置、快速的启动和强大的依赖管理,已经成为微服务架构中的主流框架。而日志系统作为任何应用的重要组成部分,Logback作为SLF4J...
目前所有的日志记录方式采用的都是同步的方式,即直接将日志写入文件。每次日志输出到文件都会进行一次磁盘IO,在多应用的时候这种效果会导致一定的线程运行延迟,所以可以采用异步的方式处理。...
SpringBoot之LogBack配置详解 LogBack是基于Slf4j的日志框架,默认集成在Spring Boot中。默认情况下,Spring Boot是以INFO级别输出到控制台。LogBack的日志级别是:ALL 。 配置LogBack可以直接在application....