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 }

最新文章

  1. CSS总结2
  2. Mysql 修改字段长度、修改列名、新增列
  3. 嵌套结构使用:struc1-struc2-XXX
  4. [wikioi]传纸条
  5. EQueue - 一个C#写的开源分布式消息队列的总体介绍(转)
  6. js_8_dom标签
  7. 利用Google趋势来预测比特币价格 - 续1
  8. 在ASP.NET Core中使用brotli压缩
  9. UnicodeDecodeError: 'ascii' codec can't decode byte 0xc7 in position 20: ordinal not in range(128)
  10. 京东饭粒捡漏V1.0.7
  11. java+Selenium+TestNg搭建自动化测试架构(2)实现跨浏览器功能
  12. mysql gtid 第一篇
  13. border_mode
  14. python 命令行升级pip
  15. 根据PID寻找程序源位置--lsof
  16. 解决:无法在发送 HTTP 标头之后进行重定向。 跟踪信息: 在 System.Web.HttpResponse.Redirect(String url, Boolean endResponse, Boolean permanent) 在 System.Web.Mvc.Async.AsyncControllerActionInvoker.<>……
  17. 一文看尽HashMap
  18. 学习笔记:A*算法
  19. C语言 · 整除问题
  20. mysql中distinct

热门文章

  1. ES2019 的新特性
  2. win7 64bit安装redis
  3. java文件操作File类
  4. 解决 “version `GLIBCXX_3.4.21' not found ”问题
  5. 【随笔】CLR:.net的类型,内部到底长啥样?
  6. C 预处理器、头文件、文件读写
  7. array list 的特点及几种遍历方法
  8. Linux 的一些命令记录
  9. 【android】关于call拨号功能实现的记录
  10. 章节十五、2-PageObjectModel