All Questions
279 questions
0
votes
1
answer
352
views
Log4j update from 2.23.1 to 2.24.0/1 -> logging gone
I have a big and old legacy project where we updated to log4j 2 very painfully and we use a lot of bridges.
<!-- LOGGING -->
<dependency>
<...
1
vote
1
answer
83
views
Dynamically set DEBUG or INFO logging level per request based on request header in reactive Spring Boot with Log4j2
I'm working on a Reactive Spring Boot application that uses Log4j2 as the logging framework. By default, my application logs at the INFO level, and I set the logging level in the application.yml
I ...
0
votes
0
answers
80
views
Log didin't write into filename that specified in log4j2-spring.xml file
Spring boot version 3.3.3, in my linux system I will have two tomcat instance under /opt, one is called /opt/tomcat (which is the dev environment, specified in conf/catalina.properties with spring....
0
votes
1
answer
371
views
MDC not logged when using SLF4J and Log4J2
I'm trying to log MDC using a json formatter in a Wildfly application. I'm hoping to see all of the MDC keys and their values in each of the logs after setting the MDC values.
I don't want to use ...
-1
votes
1
answer
64
views
Setting logger for com.mongodb.internal.diagnostics.logging.SLF4JLogger does not work
Running with Spring Boot, I get logs like this
c.m.i.d.l.SLF4JLogger : Command "insert" started on database "test" using a connection with driver-generated ID 3 and server-...
0
votes
1
answer
90
views
How to understand logging in our application
Our application uses,
For normal logging (.log) : log4j2 supported by log4j-core.jar, log4j-api.jar, log4j2-extensions.jar
For console logging (.out) : log4j (1.2) because we have jboss that uses ...
1
vote
1
answer
63
views
Purpose of setting debug="false" in log4j at configuration level
What is the purpose of setting attributes at configuration level in log4j.xml?
<log4j:configuration
xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="false" ...
0
votes
0
answers
57
views
Logs file getting created but logs are not getting written to it in springboot 3 war deployed on Tomcat 10.1.19
log4j2.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG">
<Properties>
<Property name="LOG_PATTERN">...
0
votes
0
answers
182
views
Setting root log level via command line for log4j2
We have a bit old J2EE application that use slf4j and log4j2 for logging. Dependencies looks like below.
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api&...
2
votes
1
answer
267
views
Maven/Java/Helidon MP: Log4j2.xml <JSONLayout> causing conflict with custom annotation processor
I have a multi module maven project. Module A has an annotation processor, and Module B has a dependency on module A in its pom.xml. Module B also has a src/main/resources/META-INF/services/javax....
0
votes
1
answer
304
views
How can I log to a specific file path with log4j2 in a library?
I have a Java Library (SDK) that will be consumed as a JAR in other applications. I'm using log4j2 and SLF4J to log right now, but when my library is consumed by the other application (also using ...
-1
votes
1
answer
85
views
Glassfish/Payara SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"
These are the logging dependencies in my pom file:
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>...
2
votes
2
answers
220
views
Log4j2 properties file JDBC appender - cast context variable to uuid
I have the following database table (PostgreSQL)
create table audit_read
(
level text,
account_id uuid,
message text
);
I want to insert a database record when a logging event occurs. I ...
0
votes
0
answers
66
views
All Logs not getting printed in console or File
So I am using Log4j2 with SLF4j for Logging in Spring Boot application. I have console and File logging enabled.
Only logs related to spring boot are getting printed on the file and console. None of ...
1
vote
2
answers
561
views
slf4j and log4j2 json messages escaped
I'm using slf4j and log4j2 as the implementation. I wanted my messages (in JSON) to be logged as JSON and not escaped as Strings.
Looking at the org.apache.logging.log4j.layout.template.json.resolver....
0
votes
1
answer
435
views
How to set log level to 'debug' when app is started in debug mode (IntelliJ)
When starting the app normally print only log.info(...) into the console. When starting the app in debug mode print log.info(...) and log.debug(...).
Can I set the debug level without reading system ...
0
votes
0
answers
79
views
log4j2 getLogger takes 20+ seconds to return
Bit of a long shot but here goes:
All this is running on an imx6 using kernel 5.10.63 and OpenJDK RTE 16.0.2+7.
I'm running a basic test app written in Java using slf4j 2.0.9 and log4j2 2.21.1.
...
0
votes
0
answers
50
views
How to exclude unpacked dependencies from third-party jars?
I have a spring boot application MyApp. MyApp is having a dependency on a third-party library ThirdParty which is also a spring-boot application. This ThirdParty library is a fat jar where all the ...
1
vote
1
answer
3k
views
ERROR FOUND : No SLF4J providers were found. and Defaulting to no-operation (NOP) logger implementation
My log file is not generated I am getting above error while start my spring boot application. please help me to resolve .
<parent>
<groupId>org.springframework.boot</groupId&...
0
votes
0
answers
43
views
How can we use log4j2 with JBOSS a long with its default logging instead of overwriting
<deployment>
<exclude-subsystems>
<subsystem name="logging" />
</exclude-subsystems>
</deployment>
instead of excluding its default logging we ...
0
votes
0
answers
163
views
Missing random Log4J2 entries in log file
I've noticed strange behavior in how Log4j logs messages and exceptions. SOme highlights of my application: SAP Hybris 6.0.0 (aka SAP Commerce), openJDK 8, Apache Tomcat, Log4j2 2.4.1 (slf4j as facade)...
2
votes
2
answers
1k
views
Why can't SLF4J find any providers in my project?
I recently forked a GitHub project and have been trying to bring it up to date. One of my primary goals was to remove the old (vulnerable) Log4J v1.2 and replace it with Log4J 2.2. The original ...
0
votes
2
answers
1k
views
approach to upgrade my log4j1.2.17 used inside springboot-starter-parent 1.5.6
Log4j1.2.17 included inside my code is not used directly, rather it is being called from another JAR file – log4j-over-slf4j1.7.25 and this Jar is being used from the spring-boot-starter-1.5.6....
0
votes
0
answers
116
views
Allure report not resolving the SLF4J2 placeholder values
We are facing an issue with the log printing format in the Allure report after migrating to SLF4J with Log4j2 implementation. I would appreciate any assistance or suggestions to resolve this problem.
...
0
votes
0
answers
70
views
Unable to silence mongoDB connection logs from log4j2 xml properties
I am trying to disable the mongodb connection logs on my application but not able to do it with the below configuration in log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
&...
1
vote
2
answers
980
views
How to set Log Pattern in log4j2-spring.xml to log Class Method and Line
I am trying to set log pattern to print Class Method and line in log file. Below is my Configuration. Its working fine with Console but not working with Async
<?xml version="1.0" encoding=...
1
vote
0
answers
212
views
SL4J with MDC/Thread context unable to read PID
I am trying to use this solution to fetch the process id and print it out in the log
RuntimeMXBean rt = ManagementFactory.getRuntimeMXBean();
String pid = rt.getName();
ThreadContext.put("PID&...
0
votes
1
answer
1k
views
Using Slf4j with log4j2 not working, throwing ClassNotFoundException: org.slf4j.LoggerFactory
This is a non-Spring app. It's a simple java app with a main. I'm using Lombok @Slf4j with a log4j2.xml config file. Gradle build file contains the following content:
dependencies {
...
...
0
votes
2
answers
564
views
How can I use Log4j2 logging on BEAM workers?
I'm trying to use Log4j2 logging implementation together with Slf4j api in the BEAM pipeline. In maven it looks like this:
<dependency>
<groupId>org.apache.logging.log4j</...
1
vote
1
answer
2k
views
Log4j does not log full stack trace?
I'm using SLF4j with Log4j2.
The SLF4j version is 1.7.22 and the Log4j2 version is 2.8.2.
When I log an exception with Log4j2 in a method, it only logs one line.
I expected the log to show the full ...
2
votes
1
answer
188
views
How to Dynamically log when iterating in a filepath and reading the contents of file How to create separate log file for each file?
I have Created a maven java project, if given a folderpath, the code will iterate over the folder and pick file one by one and read all the contents of file (file type supported-txt,pdf,word,excel,csv,...
5
votes
1
answer
6k
views
What is Spring Boot Starter Log4J2
Well, I think the title describes the question. I know that I should use spring-boot-starter-log4j2 if I wanted to use log4j2 as my logging framework in spring. But my question is, how does it ...
5
votes
1
answer
11k
views
java.lang.NoSuchMethodError: 'void org.apache.logging.slf4j.Log4jLoggerFactory.<init>(org.apache.logging.slf4j.Log4jMarkerFactory)'
im currently on a apache flink job which provides log4j2 as default logging implementation at its runtime (see here).
For flexibility SLF4J should be used.
Running the whole job in flink logs properly,...
0
votes
1
answer
513
views
log4j stops logging (some) log message
We are running a fairly typical but "legacy" webapp using log4j under slf4j and Spring 5.3.18. (I'll update with versions of log4j/slf4j) We use an external log4j config file specified on ...
2
votes
1
answer
716
views
slf4j marker when used with fluent apis is ignored by log4j2 configuration, but works fine with non-fluent apis
slf4j marker when used with LoggingEventBuilder apis (fluent) is ignored by log4j2 configuration, but when same marker is used with slf4j Logger non-fluent apis [e.g., trace(Marker marker, String msg)]...
0
votes
1
answer
114
views
Log4j common custom interface
I am using slf4j and log4j2 and i want to create a common interceptor. like below so in future if any log4j uprade came up, i would not have to change every class.
Please review below code and let me ...
0
votes
1
answer
2k
views
Logging structured key-value pairs in springboot with slf4j over log4j2
I'm working on a Kotlin spring-boot project that is using slf4j over log4j2 and I would like to log in a key-value way in order to add filters based on the keys to the data analyzer (splunk) I'm using....
3
votes
1
answer
1k
views
Log4J2 Pattern Layout not picking up Pattern
I have set up a service to use SLF4J and Log4j2 but I am unable to get the specified logs in the pattern layout specified. My dependencies are:
log4j-slf4j-impl: 2.17.2
slf4j-api: 1.7.36
When I boot ...
2
votes
0
answers
118
views
SLF4J multiple bindings Spring boot with weblogic
I updated my spring boot application version to 5.3.24, and I excluded the logback from all dependencies, I checked it with dependency:tree
[INFO] | +- org.springframework.boot:spring-boot-starter:...
1
vote
1
answer
244
views
log4j2 - disable dependency service logs logged into my application.log
i have a log4j2 setup in my project
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="ERROR">
<Properties>
<Property name=&...
1
vote
2
answers
3k
views
Does Log4j2 and SLF4J MDC get along?
Using Finatra, I'm trying to activate traceID logging, but nothing ends up in Log4J2 output.
Finatra supports SLF4J MDC.
SLF4J MDC is supposed to support Log4J (2?).
Log4J2 is supposed to support MDC ...
2
votes
1
answer
13k
views
"SLF4J: No SLF4J providers were found" after moving from JDK8 to JDK11
After moving from JDK8 to JDK11 I get "SLF4J: No SLF4J providers were found" and not logging.
Using Maven and IntelliJ.
Output:
SLF4J: No SLF4J providers were found.
SLF4J: Defaulting to no-...
2
votes
1
answer
802
views
Helidon MP: How to send slf4j log messages to Kafka broker?
I am trying to send slf4j log messages in my Helidon MP application to a Kafka server that runs on port 9092. I have the following class as an example:
import lombok.extern.slf4j.Slf4j;
@Slf4j
public ...
0
votes
0
answers
581
views
Class Not Found Exception after slf4j-log4j12 version upgrade to 1.7.36
After upgrading slf4j-log4j12 version, we are seeing below errors.
Please let us know if anyone has faced the similar issues after upgrade. Appreciate the help!
Error:
log4j:ERROR Could not ...
0
votes
1
answer
2k
views
How to check my Junit test is picking the log4j2-test.xml config or not?
I have some unit test written in my project I wanted to change the logging behaviour for unit test so I created a log4j2-test.xml in src/test/resources but I am not able to see any change in my ...
1
vote
1
answer
1k
views
TRACE level messages not being logged. log4j How to enable trace logging level
I'm currently working on a maven application that uses slf4j/log4j and I want to be able to output all log levels including trace to the console. I've configured as follows:
<?xml version="1.0&...
0
votes
1
answer
289
views
CustomOutInterceptor always get the instance of super class
To log SOAP request and response payloads, I've enabled the cxf logging and was using the default interceptors which works seamlessly. But client also wants to add Transaction-ID with in the ...
0
votes
1
answer
616
views
Support on disabling debug and info logs of Springboot and hibernate when hosted on AWS Lambda
We have hosted a springboot application to AWS lambda. We are receiving huge logs which is not expected. We have tried the following ways to optimize our logs
https://www.baeldung.com/java-enterprise-...
3
votes
0
answers
1k
views
Error generating native image with Gluonfx for log4j and slf4j dependencies
I'm trying to build a native image of a JavaFX app with Gluonfx, Micronaut and Graalvm
As logging framework I'm using log4j2 and log4j-slf4j-impl to route logs from slf4 to log4j.
Every time I want to ...