Questions tagged [slf4j]

1

votes
1

answer
681

Views

How to log MDC with Spring Sleuth 2.0?

referring to quesition/answer in How to log MDC with Spring Sleuth? I think this has/will change(d) with spring-cloud 2.0 as there is no SpanLogger or Slf4jSpanLogger anymore (or I don't find it) Wouldn't it be nice if application properties spring.sleuth.baggage-keys and spring.sleuth.propagation-k...
Dirk Hoffmann
1

votes
1

answer
2.8k

Views

Scala “constructor Stopwatch cannot be accessed in class Main”

Summary on resolution, I thought I was dealing with a Scala problem but it turns out Stopwatch and Scala Logging have private constructors, and I was not calling the proper public methods to instantiate them. gzm0's answer below points this out. Trying to use Guava Stopwatch and Scala Logging, no ma...
JimLohse
1

votes
1

answer
124

Views

NullPointerException getting bean class name in @Produces method

I have this LoggerProducer class that's injected in a @Stateless bean to generate log entries as explained here. Problem is that when CustomerBean is invoked (without even calling logger.info), the @Produces method (that retrieves the bean class name) fails with NullPointerException. What is wrong w...
ps0604
1

votes
2

answer
2.2k

Views

JUL to SLF4j with oracle jdbc driver

I am trying to redirect java.util.logging messages logged by the oracle jdbc driver and the oracle ucp (universal connection pool) library, but not able to do so. The messages logged by my application using JUL get logged but the ones logged by the oracle libraries are not getting logged. My intent...
Andy Dufresne
1

votes
1

answer
122

Views

Can't Change Apache Jena Logging Level (using log4J2)

I have included the Apache Jena library to my Java project and I am using Apache Log4J2 as my logger. I have also included the log4j-1.2-api and log4j-slf4j-impl dependencies for mapping from Log4J v1.x and SLF4J (respectively). However, I am unable to change the logging level for Jena! I have tried...
Brandon Dudek
1

votes
1

answer
625

Views

Suppress debug logs with slf4j simple logger

I am using slf4j-simple. How do I set the default log level for springfox to info, while keeping debug logs from all other sources? The logger properties file is in this location: src main resources simplelogger.properties simplelogger.properties: logging.level.springfox=info org.slf4j.simpleLogger....
Queue
1

votes
1

answer
208

Views

Using slf4j as an abstraction for log4j2

I am working on a JAVA project where all the logging in the code is done by using slf4j. e.g. package my.project.package; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MyClass { private Logger logger = LoggerFactory.getLogger(MyClass.class); //some attributes, their getters a...
overflow
1

votes
1

answer
275

Views

Using Log4j2.10 and slf4j-api 1.8 in OSGI/Eclipse

I am trying to use Log4j2.10 and slf4j-api 1.8 beta1 in my eclipse project. I cannot get the binding to work,slf4j complains with: SLF4J: No SLF4J providers were found. SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#noProviders for further de...
Rob Gansevles
1

votes
1

answer
152

Views

Logback SizeBasedTriggeringPolicy is not rolling

I have this configurarion: ${SCRIPTMON_HOME}/logs/scriptMon.log %d{yyyy-MMM-dd HH:mm:ss.SSS} %-5level [%thread] %logger{15} - %msg%n ${SCRIPTMON_HOME}/logs/scriptMon.%d{yyyy-MM-dd}.%i.log.zip 1 10 5MB IFAIK my logfile must rotate when it reaches 5MB (this is all I want regardless the date). I can in...
Marcelo Ribeiro
1

votes
0

answer
29

Views

Error-slf4j-error try to get loggers

I am getting following error when I am trying to use loggers for Java class %PARSER_ERROR_d [%PARSER_ERROR_thread] %PARSER_ERROR_level %PARSER_ERROR_logger - %PARSER_ERROR_msg%PARSER_ERROR_n%PARSER_ERROR_d [%PARSER_ERROR_thread] %PARSER_ERROR_level %PARSER_ERROR_logger - %PARSER_ERROR_msg%PARSER_ER...
1

votes
1

answer
256

Views

Assert Application Logging in Junit Tests

We want to write tests that assert certain content being logged as a part of an Application Startup. How should we do it ?
GaVaRaVa
1

votes
0

answer
43

Views

What is semantic of org.slf4j.Logger.isDebugEnabled(Marker)?

Slf4j has boolean isDebugEnabled(Marker marker) and Javadoc says nothing about marker argument. Logback implementation public boolean isDebugEnabled(org.slf4j.Marker marker) leads to: public abstract FilterReply decide( Marker marker, Logger logger, Level level, String format, Object[] params, Throw...
gavenkoa
1

votes
2

answer
126

Views

SL4J configuration change or regex to mask email(recognized by '@' and '.com' ) in a Json

I want to mask email address in Java from a JSON while logging as a part of security protocols. I have tried the primitive method of replacing using the string operations and it's not possible for me to search through the complete project. Is there any possible configuration in SL4J or regex is the...
Mossad
1

votes
1

answer
166

Views

How to modify SLF4J log output

how can I supress the classnames in sl4j? public class LogManager { static Logger logger = LoggerFactory.getLogger(classname); static void log(String sender, String msg) { logger.info(sender + ' - ' + msg); } } The output of this its something like this: 2018-05-23 16:15:41,000 [ 196598] WA...
DynamicBit
1

votes
0

answer
26

Views

Log the exceptions in separate files for each tenant in multi-tenancy architecture

I have an application with multi-tenancy support, that is one server and multiple DB, there will be separate DB for each tenant. All the exceptions thrown in the application will be logged in one single log. The tenant ID will be printed along with the exception. I would like to handle it in the sep...
1

votes
1

answer
456

Views

java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V

I get this error when I run my project with Tomcat 8.5 server in Eclipse: SEVERE: Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener] java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Lja...
atila665
1

votes
2

answer
102

Views

How to recognize business log from Spring application log and tag them in Logger.info()?

I'm using Spring Boot and Logback to record my log. The requirement is that I want to recognize business log from Spring application log and tag them in Logger.info(). For example: In one of my Foo.service LOGGER.info('this is my business log, I want to tag it') I want to differentiate it from the...
zhatian diao
1

votes
0

answer
32

Views

Setting priority for loading slf4j jar from custom path apart from JRE

Am upgrading jetty 4.2.24 to jetty 9.2.25,i got a dependency with slf4j version for jetty. jetty 9.2.25 requires slf4j 1.7.5 but am using 1.5.6 version for both jetty web server and JACORB. the problem am facing here is jetty is taking the jar directly under JVM /ext path, i cant replace the slf4j 1...
guest
1

votes
1

answer
181

Views

slf4j + lombok + additional logger

I would like to add an additional logger in my class using lombok + @slf4j. Currently, I am using @Slf4j which creates private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LogExample.class). I am using this for standard logging I would like to create another logger for spec...
user518066
1

votes
0

answer
304

Views

ch.qos.logback.core.util.IncompatibleClassException starting tomcat 9.0.2

Tomcat Version: 9.0.2 we followed this guide: https://github.com/tomcat-slf4j-logback/tomcat-slf4j-logback We are using slf4j in the webapp and we followed the guide on the github project but when we start tomcat we get a IncompatibleClassException Inside the apache-tomcat-9.0.2/lib/ bash-4.2$ ll /o...
Arturo De Zorzi
1

votes
0

answer
36

Views

Disable Third party modules logging in Java application

I am using third party framework and our application and that framework both are having same logger slf4j. I have deployed my application on Tomcat and IBM WAS. Now I am seeing few severe exceptions from that framework, which I want to hide, and only want to see the logs of my application. Please su...
Ankit Thakur
1

votes
1

answer
64

Views

slf4j, logback, the target compressed file named exist already

logback 1.1.5 + slf4j 1.7.4. Rollover at midnight 00:00:00,163 |-INFO in c.q.l.co.rolling.helper.RenameUtil - Renaming file [/opt/wls/appl/log/out.log] to [/opt/wls/appl/log/out.log1294410077875834.tmp] 00:00:00,164 |-INFO in ch.qos.logback.core.rolling.helper.Compressor - ZIP compressing [/opt/wls/...
OGSL
1

votes
1

answer
307

Views

ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder

I am converting a spring app to spring-boot, using boot-starter-parent version: 2.0.4.RELEASE. When I build using mvn install, its is going through fine, but when I am trying to run the app using command:mvn spring-boot:run -Dspring.profiles.active=dev, I am getting this exception: ClassNotFoundExce...
Nitin1706
1

votes
0

answer
124

Views

Unable to change log level in dropwizard during runtime

my config.yml file looks something like this(logging section): logging: level: INFO loggers: com.company.package: ERROR appenders: - type: console threshold: DEBUG This sets all logging on the com.company.package to ERROR. I want to override this at runtime for dev environment, to log debug level lo...
hal9000
1

votes
1

answer
63

Views

Is there any triggering policy like SizeAndTimeBasedTriggeringPolicy with FixedWindowRollingPolicy in logback.xml?

In my spring boot project,I am using spring logback.xml. I have a use case in which I have to roll over the file based on file size and date whichever is first and also I need to keep the count of rolled over files to 2 only. I was thinking to use following : test.log test.%i.log.zip 2 5MB %-4relat...
Piyush Kumar
1

votes
0

answer
32

Views

Logging level DEBUG inside a body of another log level INFO

We have a JavaEE EAR application that's deployed on Payara 4.1.2.1. This application have dependency on: org.slf4j slf4j-log4j12 1.7.2 What's happening is that the server.log are fully increase with DEBUG log message inside a body of INFO log message for a lot of frameworks and librarys that's used...
Darlyn Vailatti
1

votes
0

answer
21

Views

logback set log level at runtime per request

I am using logback.xml (slf4j) for logging in my application. In production, my logger is set at ERROR mode. I want to change the log level to 'DEBUG' for a particular request which has my test data ( example: msisdn is '1234512345' ); for all other requests, the log set level should be at ERROR. So...
Ravish
1

votes
0

answer
168

Views

Liquibase 3.6.2 logLevel=debug not honored?

It seems that liquibase 3.6.2 does not honor the debug flag (--logLevel=debug). I have all the required dependencies and everything works OK but it is in 'super-silent' mode. I can not see on the console which changesets have been executed/applied (which I could in liquibase 3.5.3). Am I doing some...
xdaiv
1

votes
0

answer
61

Views

Truncating stacktraces of exceptions in logger based on condition

I'm using slf4j to log custom exceptions and their stack traces in both console and a custom file. I met a situation that I had to truncate the stack traces of some non-critical exceptions. Using this documentation, I added the following configuration in my logback.xml file throwable != null && thr...
Abhishek
1

votes
0

answer
33

Views

Unable to Log debug loggers using SLF4J + Log4J

We were using only Log4J framework in our web application and it was working fine. Now, I'm trying to integrate SLF4J + Log4J so that it will be easy for us to migrate to any kind of logging framework like Log4j2 or logback in the future. Jars Used: log4j-1.2.17.jar slf4j-log4j12-1.7.25.jar slf4j-ap...
Madhu Gali
1

votes
0

answer
47

Views

Spring Boot and RabbitMQ exception logging

I have a Spring Boot application (latest version) that receives a message in a controller, enqueues it in a RabbitMQ (also latest version) and then process it asynchronously. Sometimes the message processing fails and an exception is thrown. This exception is logged in WARN level. How can I set up t...
italktothewind
1

votes
0

answer
221

Views

slf4j logging not printing in server.log file instead it is printing on console - wildfly

I have satndalone.xml with logging config, and pom.xml with slf4j dependency configured. Using lombok.extern.slf4j.Slf4j api annotations(@Slf4j) for logging in java classes. The issue is the logs using this Slf4j are printing on console but not printing in the server.log File in wildfly server. I h...
ddc
1

votes
0

answer
41

Views

Is it possible to separate logback logs to separate appenders based on the log marker?

I'm using Logback with SLF4J underlying in my application, and would like to send a couple of specific log messages to a file separate to the main log file. I don't really want to do this with log levels as that would mean I wouldn't be able to filter them out of the main log if the levels were adju...
ca55idy
1

votes
0

answer
22

Views

How can I provide a supplement to an existing Logback configuration?

I need to provide a drop-in solution for obfuscating certain patterns that occur in log output. The idea is that I can provide either a supplemental config file or a configuration class that will modify the existing Logback configuration to start utilizing my obfuscation logic. Currently, I have a l...
Mike Medina
1

votes
0

answer
37

Views

Wait for asynchronous logging to finish before Thread ends slf4j/log4j2

I'm using an asynchronous database logging setup with slf4j/log4j2. All is working as expected. The only drawback is, that sometimes when the server is shut down the logger has not completed writing to the database (e.g. if there was a burst before shutdown). I get: WARN AsyncLoggerConfigDisruptor...
Jens Popp
1

votes
1

answer
45

Views

How to write slf4j-over-logback logs as JSON

I have the below logging statements in my code. import org.slf4j.Logger; public class MySampleClass { private static final Logger logger = LoggerFactory.getLogger(MySmapleClass.class); public void mySampleMethod(List userID) { logger.debug('userRuntimeId =' + userId); . . . Business Logic . . } } My...
Deepboy
1

votes
0

answer
31

Views

The easiest way to build custom logger in SLF4J?

I'm working on a project which will run on Jenkins pipeline as a step, which employes jcifs-ng. As jcifs-ng uses SLF4J for logging propose, I want to write a custom logger which can redirect all logging output of jcifs-ng to Jenkins logging callback. My current idea is creating a new class which ext...
TJM
1

votes
2

answer
76

Views

Create log files for each date in separate directory with current system date

I am trying to save logs of my spring-boot application for each date in a different directory with the current date, month and year. I have tried using timestamps it stores the logs in the separate directory only if we restart the tomcat server every day. [%d{yyyy-MM-dd HH:mm:ss.sss}][%-5p][%C][%t][...
DarkDuster
1

votes
0

answer
39

Views

Spring Boot Gradle project using Flink does not work

I have a Spring Boot Gradle project that uses LogBack log. I want it to support Flink, but Flink is using Log4j. When I started the project, it just stayed that way. The two don't work when combined. dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' testImplementation...
夜神月
1

votes
1

answer
17

Views

How to fix empty dashboard screen in Knowage?

I try to get knowage running in a docker environment. After several issues to get knowage running I finally managed to log in. After some more issues I was also able to connect knowage to a fiware orion context browser. However, when I try to add a cockpit to my workspace, I receive an empty conten...
Kevin

View additional questions