org.slf4j.helpers.Log4jLoggerFactory is not on classpath. Good!
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache license, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the license for the specific language governing permissions and
15 * limitations under the license.
16 */
17 package org.apache.logging.slf4j;
18
19 import java.net.URI;
20
21 import org.apache.logging.log4j.spi.LoggerContext;
22 import org.apache.logging.log4j.spi.LoggerContextFactory;
23 import org.apache.logging.log4j.status.StatusLogger;
24
25 /**
26 *
27 */
28 public class SLF4JLoggerContextFactory implements LoggerContextFactory {
29 private static final StatusLogger LOGGER = StatusLogger.getLogger();
30 private static LoggerContext context = new SLF4JLoggerContext();
31
32 public SLF4JLoggerContextFactory() {
33 // LOG4J2-230, LOG4J2-204 (improve error reporting when misconfigured)
34 boolean misconfigured = false;
35 try {
36 Class.forName("org.slf4j.helpers.Log4jLoggerFactory");
37 misconfigured = true;
38 } catch (final ClassNotFoundException classNotFoundIsGood) {
39 LOGGER.debug("org.slf4j.helpers.Log4jLoggerFactory is not on classpath. Good!");
40 }
41 if (misconfigured) {
42 throw new IllegalStateException("slf4j-impl jar is mutually exclusive with log4j-to-slf4j jar "
43 + "(the first routes calls from SLF4J to Log4j, the second from Log4j to SLF4J)");
44 }
45 }
46
47 @Override
48 public LoggerContext getContext(final String fqcn, final ClassLoader loader, final Object externalContext,
49 final boolean currentContext) {
50 return context;
51 }
52
53 @Override
54 public LoggerContext getContext(final String fqcn, final ClassLoader loader, final Object externalContext,
55 final boolean currentContext, final URI configLocation, final String name) {
56 return context;
57 }
58
59 @Override
60 public void removeContext(final LoggerContext context) {
61 }
62 }
org.slf4j.helpers.Log4jLoggerFactory is not on classpath. Good!的更多相关文章
- java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext问题原因及解决方法
一.错误信息 java.lang.ClassCastException: org.slf4j.impl.Log4jLoggerFactory cannot be cast to ch.qos.logb ...
- Atitit.日志系统slf4j的使用
Atitit.日志系统slf4j的使用 SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar ...
- slf4j介绍以及实现原理窥探
一.概述 slf4j(全称是Simple Loging Facade For Java)是一个为Java程序提供日志输出的统一接口,并不是一个具体的日志实现方案,就好像我们经常使用的JDBC一样,只是 ...
- 常见java日志系统的搭配详解:关于slf4j log4j log4j2 logback jul jcl commons-logging jdk-logging
先看一张图: 是不是有点晕, 晕就对了.这个仅仅是 slf4j 的情况,实际上, 我们不仅要接触到 slf4j ,有时候还会接触其他的日志系统.且看下文分解. 1 直接使用各个日志系统 1.1 直接使 ...
- SLF4J multiple
"C:\Program Files\Java\jdk1.8.0_65\bin\java" -Didea.launcher.port=7537 "-Didea.launch ...
- SpringBoot LoggerFactory is not a Logback LoggerContext but Logback is on the classpath
SpringBoot 在启动项目的时候一起错误: SLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in ...
- slf4j教程
slf4j只是一个门面(facet),它不包含具体的实现,而是将一些log4j,java.logging等实现包装成统一的接口.借用下图展示了常用日志文件的关系: 通过上面的图,可以简单的理清关系! ...
- SLF4J warning or error messages and their meanings(转)
The method o.a.commons.logging.impl.SLF4FLogFactory#release was invoked. Given the structure of the ...
- 实现jul 日志重定向到 slf4j
需求背景 jul 指的是java.util.logging,是 java 内置的日志模块,目前流行的Java日志组件还包括 jcl(common-logging).slf4j/log4j/logbac ...
随机推荐
- 【搜索】N皇后问题
原题传送门 思路 很经典的搜索题,但本蒟蒻卡了1个多小时,搜索部分很简单,但是判重的部分是真的蛋疼,我写了一个高效率的判重算法,但是无论检查多少遍都没有问题的算法却总是WA......后来我干脆写了一 ...
- a 标签 pointer-events
a 标签渲染到也页面之后,由于某些原因需要,禁用. 有两种方法可以设置禁用效果. 1.使用 CSS 属性 pointer-events ,设置此属性为 none 之后,元素将不会成为鼠标事件的 tar ...
- centos 文本文件编码转换
iconv -f utf-8 -t gbk shtel_single_utf8.mlf > shtel_single_gbk.mlf
- 阿里云CentOS7.x安装nodejs及pm2
对之前文章的修订 您将了解 CentOS下如何安装nodejs CentOS下如何安装NVM CentOS下如何安装git CentOS下如何安装pm2 适用对象 本文档介绍如何在阿里云CentOS系 ...
- UVA 10790 How Many Points of Intersection? 组合数学
We have two rows. There are a dots on the top row and b dots on the bottom row. We draw line segment ...
- 面试官:说说Mysql数据库分库分表,并且会有哪些问题?
之前一篇文章已经谈到了数据库集群之主从集群也就是读写分离,也提到了读写分离其实只是分担了访问的压力,但是存储的压力没有解决. 存储的压力说白了就是随着系统的演化,需求的增加,可能表的数量会逐渐增多,比 ...
- Spring Cloud 新一代Web框架微服务翘楚(一)
序言 springcloud是微服务架构的集大成者,将一系列优秀的组件进行了整合.基于springboot构建,对我们熟悉spring的程序员来说,上手比较容易. 通过一些简单的注解,我们就可以快速的 ...
- 统一批处理流处理——Flink批流一体实现原理
实现批处理的技术许许多多,从各种关系型数据库的sql处理,到大数据领域的MapReduce,Hive,Spark等等.这些都是处理有限数据流的经典方式.而Flink专注的是无限流处理,那么他是怎么做到 ...
- 『公交线路 状压dp 矩阵乘法加速』
公交线路 Description 小Z所在的城市有N个公交车站,排列在一条长(N-1)km的直线上,从左到右依次编号为1到N,相邻公交车站间的距离均为1km. 作为公交车线路的规划者,小Z调查了市民的 ...
- C#, CSV,Generic, 泛型,导出
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...