slf4j

Custom AppenderBase not being called

纵然是瞬间 提交于 2019-12-24 10:06:53
问题 I am writing a custom AppenderBase for my test and configuring it in logback-test.xml The append() function however is not being called. import ch.qos.logback.core.AppenderBase; import org.apache.log4j.spi.LoggingEvent; import java.util.ArrayList; import java.util.List; public class TestAppender extends AppenderBase<LoggingEvent> { public static List<LoggingEvent> events = new ArrayList<>(); @Override protected void append(LoggingEvent e) { events.add(e); } } This is my configuration file :

Spring: “SimpleLogger does not seem to be location aware” exception

末鹿安然 提交于 2019-12-24 08:47:22
问题 I'm getting an exception in a Spring app on my first line of code: ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml"); I have commons-logging-1.1.1.jar configured as a project library. Here is the stack trace: java.lang.UnsupportedOperationException: The logger [org.slf4j.impl.SimpleLogger(org.springframework.context.support.ClassPathXmlApplicationContext)] does not seem to be location aware. at org.apache.log4j.Category.log(Category.java:347) at org.apache.commons

totalSizeCap in logback doesn't seem to be working as expected

偶尔善良 提交于 2019-12-24 06:47:25
问题 I've the below mentioned logback file. I want to delete any logs older than 2 days or if the size of the logs exceed 500KB. Logs older than 2days are getting deleted as expected. However Logs which exceed 500KB are not getting deleted . I tried to use ch.qos.logback.core.rolling.TimeBasedRollingPolicy as well but the behavior is the same. <property name="DEV_HOME" value="/home/kishore/test/logs" /> <appender name="INFO_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender"> <!-- <file>

sl4j error in weblogic when deploying grails application war

帅比萌擦擦* 提交于 2019-12-24 00:46:19
问题 I create a WAR for my grails application and when I deploy it in Weblogic 12c server I get the following Exception <Mar 27, 2012 12:38:55 PM PDT> <Warning> <HTTP> <BEA-101162> <User defined listener org.codehaus.groovy.grails.web.context.GrailsC ontextLoaderListener failed: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/Strin g;ILjava/lang/String;Ljava/lang/Throwable;)V. java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg

sl4j error in weblogic when deploying grails application war

南楼画角 提交于 2019-12-24 00:38:05
问题 I create a WAR for my grails application and when I deploy it in Weblogic 12c server I get the following Exception <Mar 27, 2012 12:38:55 PM PDT> <Warning> <HTTP> <BEA-101162> <User defined listener org.codehaus.groovy.grails.web.context.GrailsC ontextLoaderListener failed: java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/Strin g;ILjava/lang/String;Ljava/lang/Throwable;)V. java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg

Use Log4j with jetty-maven-plugin 9.x

百般思念 提交于 2019-12-24 00:23:30
问题 How can I enable Log4j for jetty-maven-plugin 9? I followed the Jetty documentation for standalone Jetty 9 and added JARs and property file. Jetty configuration: <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>9.0.5.v20130815</version> <configuration> <webApp> <contextPath>/mywebapp</contextPath> <jettyEnvXml>jetty-env.xml</jettyEnvXml> </webApp> <systemProperties> <systemProperty> <name>log4j.configuration</name> <value>log4j-jetty

SLF4J - What is a dangling or detached marker?

旧街凉风 提交于 2019-12-23 20:33:19
问题 In SLF4J I'm not entirely sure what a detached marker is. The JavaDoc is rather ambiguous. Some questions: Is it purely memory management of Markers ie to stop/start markers being garbage collected? What happens when you log with a dangled/detached marker? If the marker is detached can you still filter on it or is it off? Why would you detach a marker during runtime? I can understand creating free form dynamic markers and thus save memory (bullet point 1) but to detach later I find bizarre.

SLF4J and Log4j 2 binding Maven dependency

♀尐吖头ヾ 提交于 2019-12-23 19:14:23
问题 Hopefully a simple question but My google foo is failing me - I've got a maven project where we're using SLF4J with Log4J 1.2 bindings. We now want to move to Log4j 2 particularly for the performance improvement - however, I can't for the life of me find the maven dependency for the log4j 2.0 binding. I've found some notes at http://logging.apache.org/log4j/2.x/log4j-slf4j-impl/ but no mention of any dependency info. I'm also slightly confused by the fact there's apparently two ways to put

Feign源码学习

独自空忆成欢 提交于 2019-12-23 17:53:36
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> feign介绍 Feign是一款java的Restful客户端组件,Feign使得 Java HTTP 客户端编写更方便。Feign 灵感来源于Retrofit, JAXRS-2.0和WebSocket。feign在github上有近3K个star,是一款相当优秀的开源组件,虽然相比Retrofit的近30K个star,逊色了太多,但是spring cloud集成了feign,使得feign在java生态中比Retrofit使用的更加广泛。 feign的基本原理是在接口方法上加注解,定义rest请求,构造出接口的动态代理对象,然后通过调用接口方法就可以发送http请求,并且自动解析http响应为方法返回值,极大的简化了客户端调用rest api的代码。官网的示例如下: interface GitHub { @RequestLine("GET /repos/{owner}/{repo}/contributors") List<Contributor> contributors(@Param("owner") String owner, @Param("repo") String repo); } static class Contributor { String login; int contributions;

Is there any way to send the stdout of a Process to SLF4J?

早过忘川 提交于 2019-12-23 12:39:09
问题 I'm essentially doing the following: Process process = new ProcessBuilder().command( ... ).start(); InputStream stdout = process.getInputStream(); LoggerFactory.getLogger( this.class ).debug...? Is there any way to write the InputStream to the logger so that it's managed by my logging settings? Or is there another approach I should take to capture the process output? update : I've rewritten this because I just realized I had read the Process/ProcessBuilder API wrong and that getInputStream()