jjzjj

LoggerContext

全部标签

java - LoggerFactory 不是 Logback LoggerContext 但 Logback 在类路径上

我认为spring-boot-starter-security中的某些模块与log4j冲突,但我不知道是哪个。我的gradle依赖如下:compile("org.springframework.boot:spring-boot-starter-thymeleaf")compile("org.springframework.boot:spring-boot-starter-security"){excludemodule:"spring-boot-starter-logging"}compile"org.apache.logging.log4j:log4j-api"compile"org

java - getCurrentLoggers 在 log4j2 中的模拟是什么

如何获取log4j2中使用的所有记录器?在log4j中,我可以像这里描述的那样使用getCurrentLoggers:Numberofloggersused 最佳答案 获取log4j2中使用的所有记录器:LoggerContextlogContext=(LoggerContext)LogManager.getContext(false);Mapmap=logContext.getConfiguration().getLoggers();注意:使用org.apache.logging.log4j.core.LoggerContext不

java - 使用 logback 关闭时是否需要刷新事件?

我们正在为几个网络应用程序从log4j迁移到logback。在关闭我们的应用程序时,我们目前调用:org.apache.log4j.LogManager.shutdown();应该刷新所有异步日志记录并关闭所有外部资源(文件、套接字)。logback中是否有类似的东西,或者它是否以某种方式在关机时自动刷新?迈克 最佳答案 这里有一个简单的方法:importorg.slf4j.ILoggerFactory;importorg.slf4j.Logger;importorg.slf4j.LoggerFactory;importch.qos

java - 获取异常 org.apache.logging.slf4j.SLF4JLoggerContext 无法转换为 org.apache.logging.log4j.core.LoggerContext

我的代码使用apache-log4j-2.0.2非常简单:importorg.apache.log4j.BasicConfigurator;importorg.apache.log4j.Logger;publicclassLog4jtest{staticLoggerlog=Logger.getLogger(Log4jtest.class);publicstaticvoidmain(String[]args){BasicConfigurator.configure();log.debug("Thisisdebugmessage");}}但是我遇到了这样的异常:Exceptioninthr