All Questions
104 questions
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
1
answer
62
views
No factory method found for class HttpAppender
I was trying to use log4j2 HttpAppender, but I get this error:
2024-09-24T07:59:58.504101611Z main ERROR Could not create plugin of type class org.apache.logging.log4j.core.appender.HttpAppender for ...
1
vote
1
answer
268
views
Multi Pod Cloud Environment Spring Boot application change log level at runtime
I have an application used spring boot + log4j2 running on openshift more than 2 pods.
However, our logging configuration changing after sprint boot initalized i mean , reconfigure. So, i do not use ...
0
votes
1
answer
69
views
Log4j is not writing logs into file
Thanks in Advance, I am trying to write logs into a file using log4j, I have tried all log4j.properties but nothing worked. Below is the code.
import org.apache.logging.log4j.LogManager;
...
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 ...
1
vote
1
answer
339
views
Spring Boot 3.2 automatically change log level during shutdown
We recently upgraded springBoot version to 3.2, and Java 21 64 bit.
We observed wired behaviour while shutting down spring boot application , log level automatically change INFO to ERROR, and we are ...
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 ...
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 ...
0
votes
2
answers
127
views
log4j2.xml is not recognised by Spring Boot
I am trying to create logs using the log4j-core Maven dependency in Spring Boot. When I try to use below code in application.properties, error logs are generated
application.properties :
# Set the ...
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
1
answer
671
views
Error when changing the log file for appending logs in a Spring Boot application
I face this error when I change the file where I write logs
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
...
1
vote
1
answer
537
views
Log4j2 JDBC Appender PoolingDriver configuration
I'm trying to configure Log4j2 using JDBC Appender with the following log4j2.xml file for my Spring Boot application:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration&...
1
vote
2
answers
981
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=...
0
votes
0
answers
71
views
EFK ibtegration with springboot dependency vulnerability issue
I'm trying to integrate my spring-boot application with the EFK Docker instance.
So when I was searching for solutions or guidance for that, I found that I had to use
Fluent Logger for Java dependency....
3
votes
1
answer
569
views
log4j2 in Spring Boot slows down my application significantly
I built a REST API with Spring Boot and I switched my logging framework to log4j2 by adding an exclusion of the default logger in my pom.xml:
<exclusion>
<groupId>org.springframework....
1
vote
1
answer
1k
views
How can I make Log Files for every Class using Log4j2?
I am currently using a Spring Boot Application, where I am logging out every Log into the console.
But Now I wanted to log every log into a specific class file name.
Example
class A {
public void ...
0
votes
2
answers
887
views
Spring boot log configuration with camunda bpmn
i know there are a few similar topics outthere, but none of these solved my problem regarding logging in spring boot applications.
The problem is this error message: Logging system failed to ...
0
votes
1
answer
339
views
Loggers from LOG4J2 doesn't display every logs in console
Here is my log4j2.xml file :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
<!--
Fichier de configuration des loggers
@author theo.lalande
Hiérarchie des ...
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 ...
2
votes
1
answer
2k
views
IllegalAccessError after updating log4j JSONTemplateLayout package
I am running a Spring boot application on java-17-openjdk. I use the log4j-layout-template-json package to output json logs to stdout.
Everything has been working fine until I updated the package ...
1
vote
2
answers
715
views
Spring Boot Log4j2 Custom Hybrid Log Layout - Mix of Pattern Layout and JSON Layout
I would like to know how I print my application logs to console in a specific format of my choice.
Our ELK stack's FileBeat daemon is configured to recognise only those Kubernetes pod logs that are in ...
0
votes
1
answer
1k
views
Splunk HTTP Event Collector Log4j2 Spring boot unable to send data to Splunk cloud
I have followed all the tutorials on youtube and I have read all the available documentation on Splunk Cloud HEC setup in Log4j2 Spring boot.
Below is my log4j2-spring.xml
<?xml version="1.0&...
3
votes
0
answers
497
views
Print logs timestamp upto micro/nano second in springboot
I want to print logs with a timestamp with precision up to micro or nanosecond in springboot.
I tried this for logging.pattern.console value
'%d{DEFAULT_NANOS} - %msg%n'
'%d{yyyy-mm-dd HH:mm:ss.SSS,...
0
votes
1
answer
9k
views
Log4j2 with SpringBoot (configuration)
I did read other questions, also I've read configuration and I came up with a solution but I don't know if it's okay.
Problem: I have SpringBoot application and I was trying to use log4j2 as logging ...
1
vote
1
answer
4k
views
How to use log4j.xml for spring boot + log4j2 dependency
I have a log4j.xml with a customized appender like:
<appender name="console" class="com.example.MyAppender">
<layout class="org.apache.log4j.PatternLayout&...
1
vote
1
answer
1k
views
Logging with JSON GELF format in Spring Boot
I'm using Spring Boot and would like to have this code:
LOG.info("Scheduled appointment for user 12345 [appointment ID 100]");
Produce the following log message in JSON GELF format:
{
&...
1
vote
1
answer
2k
views
How to Stop Spring boot applications console logs in var/log/messages file
We're using spring boot and log4j2 for logging. We have specified the log path and it is working. But the same console logs are moving to var/log/messages file
Can someone please help me how to stop ...
2
votes
0
answers
779
views
How to exclude a package from root tag in xml configuration log4j2
I am trying to disable the logging of a package for certain appenders, but I still have them logged everything else.
I have tried:
<?xml version="1.0" encoding="UTF-8"?>
<...
0
votes
1
answer
2k
views
Migrating from log4j2 to logback
I am currently migrating logging feature from log4j2 to logback. I have some doubtful situations in the migration process. My doubts are related to JSON format conversions. First of all I will list ...
0
votes
1
answer
570
views
Spring Boot, syslog & log4j2 log
I want to send a singular log message to our external syslog server but don't want to use log4j2, instead is it possible to just send a plain TCP message using something like java.net & java.io?
0
votes
1
answer
144
views
Change where RollingFile log4j2 writes the log with variables
I need to be able to modify the location where my log4j2.xml file writes log files.
I would like to create a folder at the same level as the .jar ( my/path/app.jar ) of the application to store the ...
0
votes
1
answer
1k
views
Is there anyway to stop Spring Boot from overwriting my log config?
I have a logger that has the following properties:
PrivateConfig [loggerConfig=Special, config=org.apache.logging.log4j.core.config.builder.impl.BuiltConfiguration@709a148, loggerConfigLevel=INFO, ...
2
votes
1
answer
1k
views
How to disable log messages when spring boot application run?
This is my log4j2.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn">
<Properties>
<Property ...
0
votes
2
answers
2k
views
How to generate new log files based on size using log4j2 in spring boot application
I am generating a log file using log4j2, but I need to generate a new one based on size each time it reaches the limit.
log4j2.properties file:
name=PropertiesConfig
property.filename =D:\\Users\\User\...
0
votes
1
answer
1k
views
Save custom level logs into file in Spring Boot
I want to save the infos of the logins that have succeded into a log file, I thought of creating a new level of logging and save into the log file only the logs with that specific level.
This is how I ...
0
votes
1
answer
262
views
In log4j2.properties, not able to read property from tomcat context.xml
I am trying to read properties from tomcat server context.xml to my log4j2.properties. I tried using {sys:} {env:} and also searched but no luck.
log4j2.properties
appender.email=org.apache.net....
2
votes
0
answers
686
views
Log4J throws illegal char <:> exception while processing Appender File in Springboot WebApp
I am using Log4J along with Springboot in my J2EE based WebApp.
It throws illegal char <:> exception while processing Appender File.
Log4J version: 2.11.1
The logger properties in my application....
0
votes
3
answers
9k
views
log4j properties file not creating log file in spring boot
I am not able to generate log file using log4j2 spring boot 2.4, it's only printing logs in eclipse console.
I already tried multiple solutions provided across web like: exclusions, renamed file to ...
1
vote
0
answers
875
views
How to increase string length using Log4j2 JsonTemplate Layout
By referring (JsonTemplateLayout Log4j2) I am trying to increase the length of the message as I am getting ... in the logs.
In the link, it's mentioned to use property maxStringLength.
I have tried to ...
0
votes
1
answer
67
views
Disabled console logging does not write to files
I am new to log4j configuration using xmls. I want to disable the console logging i.e only logs with level Error should come on console. Rest of the logs should go to their respective files.
Here is ...
0
votes
3
answers
543
views
log file is not generating using log4j2 in spring boot
I am using Log4j2 for logging with Spring Boot , but it is not creating the log file. Given below is my configuration for Log4j2 and dependencies i added. i tried all possible solution.
Log4j2 ...
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....
1
vote
1
answer
325
views
Extend Log4j2 Tests
I have a wrapper for log4j2 Logger class - e.g.
import org.apache.logging.log4j.core.Logger;
public class MyLogger extends Logger {
protected MyLogger(LoggerContext context, String name, ...
2
votes
1
answer
1k
views
Inject/Access Spring Bean into Log4j2 Plugin
I have a configuration properties class that I want to inject into a custom log4j2 RewritePolicy.
e.g.
@Plugin(name = "MyPolicy", category = "Core", elementType = "...
1
vote
1
answer
627
views
How to load application.properties into Log4j2 LogEventPatternConverter class?
I am working on a task that I want to mask sensitive data using Log4j2 LogEventPatternConverter Class.
@Plugin(name="SensitiveDataLog", category = "Converter")
@ConverterKeys({&...
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
2k
views
Camel 3.5 Logger, Spring Boot and log4j2
I'm using Camel 3.5 and Spring Boot 2.3.4 app.
I'm trying to use log4j2 and config log levels and appenders in a log4j2.xml file.
It works from a Processor but not directly in a RouteDefinition.
...
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
2
answers
1k
views
how to collect and write logs to file in batches after time interval using log4j2 or logback in java
I am trying to make a custom log appender using log4j2. My problem is I don't want to write log immediately to a file appender but after. So, ideally, my spring boot app should collect all the logs in ...