![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
logback
Web3&Basketball
编程和运动,诗和远方
展开
-
Spring、Mybatis和Logback系统配置,替换原来的log4j并打印sql日志
最近在重构日志功能,从原来的log4j改成现在的logback, Step 1: 在pom.xml文件删除log4j的依赖,加入logback的依赖,下面为所有logback的依赖jar包: dependency> groupId>org.springframeworkgroupId> artifactId>spring-contextartifact原创 2018-01-12 15:39:17 · 8556 阅读 · 0 评论 -
Logback (8) | Logback error messages and their meanings
Logback error messages and their meanings 更详细信息: https://logback.qos.ch/codes.html原创 2018-01-29 18:02:56 · 479 阅读 · 1 评论 -
Logback (7) | Missing integer token, that is %i, in FileNamePattern
logback.xml配置日志的时候 appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender"> filter class="ch.qos.logback.classic.filter.LevelFilter"> lev原创 2018-01-29 10:01:25 · 15724 阅读 · 6 评论 -
Logback (6) | SizeAndTimeBasedFNATP is deprecated. Use SizeAndTimeBasedRollingPolicy instead
logback 日志处理的时候,原文件: appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender"> filter class="ch.qos.logback.classic.filter.LevelFilter"> leve原创 2018-01-27 19:42:20 · 7893 阅读 · 2 评论 -
Logback (5) | The FileNamePattern option must be set before using TimeBasedRollingPolicy
在logback.xml配置的时候,如下: appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender"> filter class="ch.qos.logback.classic.filter.LevelFilter">原创 2018-01-27 20:17:02 · 4501 阅读 · 2 评论 -
Logback (4) | 无法打印出自定义的日志信息
在做Spring、Mybatis和Logback集成日志解决方案的时候,发现在控制台能够打印出系统日志,但是无法打印出自定义日志package com.spacex.dang;import org.slf4j.Logger;import org.slf4j.LoggerFactory;public class LogbackTest { private static L原创 2018-01-19 16:21:05 · 4131 阅读 · 0 评论 -
Logback (3) | Could not find Janino library on the class path. Skipping conditional processing.
在做Spring、Mybatis和Logback的集成时候,logback.xml中可以写表达式: if-then form --> if condition="some conditional expression"> ... if> if-then-else form --> if condition="some conditio原创 2018-01-16 11:07:13 · 6808 阅读 · 1 评论 -
Logback (2) | TriggeringPolicy has not started. RollingFileAppender will not start
Spring,Mybatis和Logback集成的时候,考虑到不同环境下,打印的日志级别不一样,采用spring profile active的方式来做,但是在网上搜了很多都是spring boot提供这种springProfile,就是spring profile active的方式来做,而spring没有,继续搜集资料发现一篇文章:Spring Configuration: If you原创 2018-01-16 20:48:33 · 1036 阅读 · 0 评论 -
Logback (1) | FileNamePattern [./logback.%d.log] does not contain a valid DateToken
Spring,Mybatis和Logback集成的时候,考虑到不同环境下,打印的日志级别不一样,采用spring profile active的方式来做,但是在网上搜了很多都是spring boot提供这种springProfile,就是spring profile active的方式来做,而spring没有,继续搜集资料发现一篇文章:**Spring Configuration If yo原创 2018-01-16 20:58:29 · 12114 阅读 · 0 评论 -
Logback (10) | MDCInsertingServletFilter req.remoteHost 和 req.xForwardedFor区别
在使用MDCInsertingServletFilter的时候,需要配置:%X{req.remoteHost} %X{req.requestURI}%n%d - %m%n发现req.remoteHost打印都是服务器地址,这是因为使用nginx代理,如果换成req.xForwardedFor就打印出真实客户端IP地址,当你使用了代理时,web服务器就不知道你的真实IP了,为了避免这个情原创 2018-01-30 10:34:51 · 1208 阅读 · 0 评论 -
Spring、Mybatis和Logback集成,用面向切面AOP方式捕获并打印异常Exception信息
Spring、Mybatis和Logback集成,用面向切面AOP方式打印异常Exception信息, Step 1: 首先定义文件CommonLogger.java:public class CommonLogger { Logger logger = LoggerFactory.getLogger(CommonLogger.class); public static原创 2018-01-20 16:53:05 · 1487 阅读 · 0 评论 -
Logback (9) | MDC And Managed Threads
MDC And Managed Threads A copy of the mapped diagnostic context can not always be inherited by worker threads from the initiating thread. This is the case when java.util.concurrent.Executors is used原创 2018-01-29 18:08:54 · 616 阅读 · 1 评论