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 ...
随机推荐
- Vue.js 创建第一个应用
VUE官网下载Vue.js文件或者用Vue的CDN地址 在项目中引入Vue.js文件 代码: <!doctype html> <html lang="en"> ...
- 探索 ASP.Net Core 3.0系列五:引入IHostLifetime并弄清Generic Host启动交互
前言:在本文中,我将介绍如何在通用主机之上重新构建ASP.NET Core 3.0,以及由此带来的一些好处. 同时也展示了3.0中引入新的抽象类IHostLifetime,并描述了它在管理应用程序(尤 ...
- 为Azure DevOps Server (TFS) 配置安全访问(HTTPS with SSL)
Contents 1. 概述 2. HTTP和HTTS比较 支持HTTP和HTTPS两种方式 要求所有连接使用HTTPS 优点: 缺点: 3. 为Azure DevOps Server 配置安全访问 ...
- 物联网架构成长之路(43)-k8s从入门到放弃
0. 前言 这段时间要入门一下CI/CD了,以前简单的了解过Jenkins,现在要把以下的这个图的架构搭建起来.国外可能一两个命令就安装完成的事情,我折腾了2天多,真的差点放弃了. 1. 安装Virt ...
- 【django json.dumps 报错】 datetime.datetime is not JSON serializable
django 中,json.dumps 无法直接转译 datetime 类型的值. 找了无数方法,找到一个最优.最简洁的解决办法: json.dumps(results, indent=4, sort ...
- Flume笔记
flume自定义拦截器:实现Interceptor接口flume自定义source:继承AbstractSourceflume自定义sink:继承AbstractSink azkaban:任务调度工具 ...
- RMI初体验--第一次错处理java.rmi.UnmarshalException&ClassNotFoundException
今天参考了一下网上Rhello示例,搞了一下RMI测试. server端是 java8 client 段是java6 然后 运行报错: java.rmi.UnmarshalException: err ...
- Excel 快捷键
自从转岗为项目经理之后,Excel的使用频率大大的增加了,所以需要有意识的学习一下快捷键,提升自己的动作效率. 如下实在Microsoft 官网找到的资料,记录下,以作后备查看: 一.通过键盘访问功能 ...
- [Flutter] 转一个Flutter学习思维导图
本文的思维导图均转自QQ群,感谢原作者(是谁?) 表单 按钮 视图 Sliver 路由 (Routes) 输入控件 对话框 MDC (Material Design Component) 状态管理 R ...
- @Valid 数据校验 + 自定义全局异常信息
关于javax.validation.Validator校验的使用 对于要校验的实体类:其需要校验的字段上需要添加注解 实际例子 使用:首先要拿到 validator的子类 Validator val ...