slf4j-api

Velocity upgrade from 1.7 to 2.0

半腔热情 提交于 2021-02-08 06:38:33
问题 I am trying to migrate from velocity 1.7 where I use LogChute interface. In my current implementation I have used the log method to get the velocity log level and comparing our own log level. Please see the code below. @Override public void log(int level, String message) { LogLevel projLevel = null; switch ( level ) { case LogChute.DEBUG_ID: projLevel = LogLevel.DEBUG ; break ; case LogChute.INFO_ID: projLevel = LogLevel.INFO ; break ; case LogChute.WARN_ID: projLevel = LogLevel.WARNING ;

SLF4J put and immediate get is failing

二次信任 提交于 2020-12-13 04:53:29
问题 I've written a little wrapper for SLF4J MDC. import org.slf4j.MDC; import java.util.UUID; public final class MdcWrapperUtility { public static final String MDC_TRANSACTION_ID_KEY_NAME = "MDC_TRANSACTION_ID"; private MdcWrapperUtility() { } public static String getId() { String threadName = Thread.currentThread().getName(); String returnValue = MDC.get(MDC_TRANSACTION_ID_KEY_NAME); return returnValue; } public static String setId() { String threadName = Thread.currentThread().getName(); String

How to Override method name in Logback logging?

我只是一个虾纸丫 提交于 2019-12-11 07:43:38
问题 I am trying to implement a logging concept with AOP but while printing the log I need give my own method name instead of the default. Update (based on the comments from @glitch): I am using the %M conversion specifier to tell Logback to include the method name in each log event. I want to replce the Logback derived method name for some log events, spcifically; for the log events emitted by my AOP joinpoint. I do not want to write the 'actual method name' somewhere else in the log event; I

java.lang.NoClassDefFoundError: Lorg/slf4j/Logger

跟風遠走 提交于 2019-12-11 04:13:28
问题 I am launching tomcat using Intellij with maven support. Once I add the following tomcat maven dependency: <!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-catalina --> <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-catalina</artifactId> <version>8.5.38</version> </dependency> Upon launching, it will throw this exception: Caused by: java.lang.NoClassDefFoundError: Lorg/slf4j/Logger; at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class