All Questions
108 questions
0
votes
1
answer
38
views
Springboot with logback working, with log4j2 working, but not working when using both
I am observing an issue when sending logs to both log4j2 and logback using kafka.
Here is the code of my very simple Springboot app:
@SpringBootApplication
public class QuestionApplication {
...
1
vote
1
answer
77
views
experiensing "Protocol vfs has not been enabled as an allowed protocol" error while deploying the Spring boot WS to JBoss EAP 8
I am working on developing a spring boot(3.3.5) web service with log4j2 as my logging library. I generated a spring boot project from spring initializer, excluded the logging from web module to ...
1
vote
1
answer
39
views
pb Logging in db with spring boot 3 and log4j2
I try to save in my db the logs of the console for querying easily on it. It's almost working. Log is ok but I have error log before the end of the spring boot context initialisation. After it's ok.
...
-1
votes
1
answer
1k
views
Correlation ID missing in logs after enabling Log4j2 with Micrometer setup in Spring Boot 3.2.0
I recently implemented Micrometer setup in my Spring Boot 3.2.0 application to enhance tracing and metrics collection, which worked fine. However, after enabling Log4j2 for improved logging, I noticed ...
0
votes
0
answers
66
views
Dynamic Log path value in the Log4j2.properties
Facing issue while substituting the dynamic log path value in the external log4j2.properties in the Spring boot application during startup
here the log4j2.properties whhich is kept outside of the ...
0
votes
2
answers
493
views
Log4j2 CLASS_NOT_FOUND Error for Layout Element in Spring Boot Project
I recently migrated to Log4j2 in my Spring Boot project and encountered an error related to the layout configuration in my log4j2.xml. Despite following the recommended configuration steps, I'm still ...
1
vote
1
answer
175
views
how to centralize log4j2 configuration with Spring Cloud Config Server
I'm using Spring Cloud Config Server File System Backend : docs.spring.io
I have a multi maven project
project:
├── pom.xml
│
├── project-config-provider
│ ├── pom.xml
│ ├── src
│ │ └── main
│ ...
0
votes
1
answer
278
views
How to inherit log4j2.xml from parent project to child?
This is my first use of log4j and I don't find any documentation regarding my problem.
I have a SpringBoot (2, and java 8) parent project with a log4j2.xml file inside it.
The file is like this:
<?...
0
votes
2
answers
982
views
Problem with log4j2 to write all logs to a specific file in Spring Boot 3.1.0 with Maven
I am trying to set log4j2 to write all logs to a specific file. I've tried various things I found on the internet but still the logs only show up in the console.
I am using IntelliJ IDEA CE.
Spring ...
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....
2
votes
0
answers
444
views
Having problem to display Traceid and Spanid in JSON format using Log4J2 in Spring Boot project
Is it possible to display the logs with JSON format and also display traceid and spanid in it by using Spring Sleuth. Please suggest the way to do this.
I have searched in google, YouTube and Github. ...
0
votes
1
answer
434
views
Multiple Slf4j bindings unable to add log4j2 spring boot
In my project have multiple slf4j bindings
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:3.0.2:compile
[INFO] | +- org.springframework.boot:spring-boot-starter-aop:jar:3.0.2:...
0
votes
1
answer
479
views
How to convert Log4j.xml to Log4j2.properties (Rewrite Polici)
i want to use Rewrite Policy for some condition in logging like masking, and then I found the solution but in log4j2.xml, however we use log4j2.properties for base config, I already try to config but ...
0
votes
0
answers
158
views
How can I use a property defined in a ".properties" file in my "log4j2.json"?
I have an application built using the Spring Framework and written in Java.
I am using the 'log4j' library for logging and have already defined a property, fr.xyz.pathLog = mypath, in my 'dev....
1
vote
1
answer
1k
views
log4j2.xml configurations are not reflected in spring boot application
I am trying to setup a project with spring boot. Although I have defined all the dependencies for log4j, and added the log4j2.xml configuration file, the logs printed doesn't have the pattern defined ...
0
votes
1
answer
373
views
How to use custom TypeConverter in Log4j2's Plugin Attribute?
Goal - What I want to do is I want to make it easier for our devs to be able to look at all the logs for certain users. So if we mention that userId in logging-config.yml, then for those specific ...
1
vote
1
answer
813
views
How can I get spring.profiles.active value in log4j2.xml
While running my Spring Boot Application, I am passing --spring.profiles.active=qa
/user/MyApp --spring.profile.active=qa
This qa value I will change based on my env.
I need to get this qa value in ...
1
vote
1
answer
240
views
Spring Boot load bean before Log4j2 initialization
Using these technologies...
spring-boot-starter 2.7.0
spring-boot-starter-data-jpa 2.7.0
spring-boot-starter-log4j2 2.7.0
I am trying to load a @Service or @Component (whichever would work) before ...
0
votes
1
answer
388
views
Log4j2 is not taking the whole configuration
I'm trying to log my application, but I have some problems.
First of all, the pattern I have set is not the same as the pattern the console prints.
My pattern:
<Console name="Console" ...
1
vote
0
answers
713
views
Spring boot 2.6.6 defect with Kafka appender
I want to upgrade my app in order to use the updated version of spring boot. Also, i am using log4j2 with a Kafka appender.
Although, when i upgrated to 2.6.6. version from 2.6.4 i had the following ...
1
vote
1
answer
693
views
Sentry log4j2 appender cannot add environment
I am using the Sentry log4j appender(version: 5.7.1) to send logged exceptions to Sentry. bellow is the log4j2.xml configuration.
<?xml version="1.0" encoding="UTF-8"?>
<...
2
votes
0
answers
1k
views
Logstash writing logs as JSON but structured arguments are missing
I am using logstash-logback-encoder:7.0.1
I am logging several structured arguments as follows
log.info("Get container",
v(StructuredLoggingFields.TENANT_ID, tenantId)...
8
votes
2
answers
12k
views
Log4j2 vulnerability and Lombok annotation @log4j2
We are using spring boot 2.1.5 and starter parent as pom dependency.
Spring boot is using default logback for logging and we haven't explicitly switched to Log4j2 or changes any configurations. Below ...
2
votes
1
answer
4k
views
Spring boot parent log4j2 update - vulnerability fix
Trying to update log4j2 for legacy spring boot application (using Spring-boot-parent-1.5.6.RELEASE) - using multi module
Tried all the ways spring suggested in recent docs but none of them worked.
...
5
votes
3
answers
7k
views
How to fix Log4J Vulnerability in Gradle Project
I can see org.apache.logging.log4j:log4j-core:2.14.0 Library in Gradle dependency tree for my project.
We have not added log4j version from outside. This version is coming as part of transitive ...
4
votes
2
answers
11k
views
Version Sanity Check (Spring/SLF4J)
I am trying to deploy Spring Boot application on Tomcat. But somehow I am getting:
Unexpected problem occured during version sanity check
Reported exception:
java.lang.AbstractMethodError: org.apache....
0
votes
1
answer
566
views
Spring Boot logging - log4j2 logging not working?
There are many post on internet advising on how to move from logback to log4j2 for spring boot logging.
Referring to this sof post -Spring-Boot logging with log4j2 - i have configured my project to ...
0
votes
1
answer
439
views
Log4j does not output to file when called by Spring Boot (but it does when called on command line)
Problem summary
I have a service which can be called by two entry points: a main() of a console app, and a rest endpoint.
The service is supposed to log to a file via a SL4J Logger.
When I call the ...
0
votes
2
answers
1k
views
Log4j log file not getting created at specified location springboot
I am trying to configure log4j2 in springboot.I have removed(excluded) the logback dependency already from pom.xml.I am using this xml under resource folder named log4j2.xml
<?xml version="...
0
votes
1
answer
604
views
Log4j2 not able to send mail
I have this controller class and log4j2 .
But I am not able to receive email in [email protected].
What I am doing wrong? I am using latest version of spring boot.
// Logger statement in ...
0
votes
1
answer
368
views
Log4j2 won't log into file in Spring boot
I'm using Spring boot and Gradle build tools. I want to add a logger which logging my events. I chose Log4j2. first of all, I have added these dependencies:
implementation group: 'org.apache.logging....
0
votes
0
answers
2k
views
Log4j2 configuration for Intellij Idea terminal
I'm using Java 11, Spring Boot 2.4.1, Intellij Idea Community Edition 2019.2.
I'm using Log4j2 and trying to change color of log level in console from log4j2.xml configuration file.
And I have success ...
4
votes
3
answers
5k
views
Spring Boot Logging override Colours
I wish to use different colours to distinguish between INFO, DEBUG and TRACE in Spring Ansi Coloured Logs, as they are currently all set to Green (see table below)
From the docs here https://docs....
1
vote
0
answers
2k
views
Log4j2 pattern layout not appending the correlation Id
I'm using HandlerInterceptorAdapter to generate a correlation id for each service request. Here is the configuration I'm using. I'm trying to append the correlation id on my console log as shown in ...
0
votes
1
answer
731
views
Why can't I log before starting a Spring Boot Application?
I am trying to log something before my Spring Boot application starts. Here is a snippet below. I am using Lombok and Log4J2 and I have done the spring-boot-starter-logging exclusion + added spring-...
0
votes
1
answer
53
views
Problem with log4j2.properties configuration file in Spring boot?
property.filename = logs
appenders = console, file
appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%-...
1
vote
1
answer
6k
views
No type attribute provided for component property in log4j2 with Spring Boot
I have implemented a simple application for streaming logs to apache kafka.In the producer, I have implemented log4j2.xml file for the configuration and now I have to convert .xml file into properties ...
0
votes
1
answer
97
views
How to make log4j2 log one file per log call?
Is there a [good practice] way in log4j2 to configure a file appender so it produces one timestamped file per call?
log.error("in file 1");
log.error("in file 2");
1
vote
0
answers
395
views
Spring log4j:WARN No appenders could be found for logger (com.classname). log4j:WARN Please initialize the log4j system properly
When I am running my springboot application, I am getting this error
log4j:WARN No appenders could be found for logger (com.system.Config).
log4j:WARN Please initialize the log4j system properly.
I ...
0
votes
2
answers
2k
views
Java - why Log4j2 is saving logs into .gz file instead of .txt
Can someone explain me why Log4j2 is saving logs into .gz file? Why not .txt?
I've changed configuration in .xml file to save in .txt and it works, but I'm not sure if it's proper way to use logs?
...
1
vote
1
answer
2k
views
Log4j 2 in Spring Boot: JDBC appender doesn't write log messages to the DB's column
Lately I'm trying to create and configure JDBC log appender, with usage of Log4j 2.
The main idea is to send a log every time we hit the particular endpoint (Spring service) and put the Hibernate SQL ...
0
votes
1
answer
653
views
Reading external xml log4j2 config file, if not exist then read internal in spring boot
I have a spring boot application that uses log4j2 and it has its XML configuration file in the resources folder.
But the idea is that first the application looks for the configuration file outside ...
2
votes
1
answer
6k
views
How to set Log4j2 level from command line
I build a Spring Boot Web Service application and I am using Log4j2.
I want to set log level by passing something like: --log4j2.level=DEBUG - How can I do that?
I didn't found any documentation for ...
1
vote
1
answer
6k
views
Logs are not loading according to Log4j2.properties
I am upgrading to Log4j to Log4j2 in my project. I have put log4j2.properties in the classpath, and its loading. Despite that logs are not coming according to properties defined in log4j2.properties.
...
0
votes
3
answers
2k
views
Spring boot profile and environment in the logfile name
How can I write the Spring Profile and the Spring Environment in the logfile name of a log file with Log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration monitorInterval="10">
...
0
votes
1
answer
890
views
Maven multiple modules with Spring Data JPA / Spring Boot / Log4j2
I'm split a spring project with Spring Data JPA into multiple modules
project-root-folder
project-data
src/main/java/project.test/App.java
src/main/ressources/log4j2.xml
pom.xml
project-ui
src/...
0
votes
1
answer
958
views
Using log4j2 and log4j at the same time in Spring project
I've a Spring Boot Applications that uses third-party library. That library uses log4j as its logger. When there is no log4j in classpath, my application fails to start because that third-party ...
11
votes
3
answers
70k
views
how to fix Unable to invoke factory method in class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile?
I am using spring boot(2.2.0.RELEASE) configure with log4j2. While deploy war in tomcat getting some run time exception.I have set system property(logging name) then that name mentioned in log4j ...
-1
votes
2
answers
806
views
Trigger custom method when log4j2's logger.error() is triggered in Spring Boot
I am using Spring Boot with log4j2 - and I'd like to trigger a custom method in a '@Service' class when logger.error(...) is triggered.
For example,
@Service
public class Foo {
private final ...
87
votes
6
answers
170k
views
Caused by: org.apache.logging.log4j.LoggingException: log4j-slf4j-impl cannot be present with log4j-to-slf4j
In my Spring boot 2 project:
In build.gradle:
dependencies {
implementation 'com.google.code.gson:gson:2.7'
implementation 'com.h2database:h2'
implementation 'javax.servlet:jstl:1.2'
...