Questions tagged [log4j2]
Log4j 2 is an upgrade to Log4j, a Java-based logging utility, that provides significant improvements over its predecessor, Log4j 1.x, and provides many of the improvements available in Logback while fixing some inherent problems in Logback's architecture.
4,155
questions
0
votes
1
answer
34
views
Application logs are not getting logged using log4j2
I am using Spring Boot and Apache Camel in my application and deploying in JBoss EAP 7.3.0 as war files. Previously the startup logs and logs from the application were getting logged to the log file ...
0
votes
0
answers
16
views
log4j levels getting wrongly printed
I have a application.porperties file with spring.active.profiles=dev and 3 files named application-dev.properties,application-int.properties and application-prod.properties.
Also i have 3 log4j2.xml ...
-1
votes
0
answers
12
views
Resilience4j retry with log4j2 logging last call
Currently with Resilience4j.retry everything gets logged and can spam errors with Log4j2.
resilience4j.retry:
instances:
backendA:
maxAttempts: 3
waitDuration: 100
...
0
votes
0
answers
16
views
log4j2 -- Today's log files are going to stored in old log files
After running the server today, my today log files are going to stored in yesterday log files.
what is the solution for this issue?
0
votes
1
answer
28
views
Log4j Bridge library using java 7
Can anyone help to understand which slf4j and log4j bridge libraries (along with version) have to use for Java 7 version when migrating from log4j1.x to log4j2.x
0
votes
1
answer
16
views
Using the start timestamp in a RollingFile
I have the following RollingFileAppender setup:
<RollingFile name="RollingFile">
<FileName>${LOG_DIR}system.log</FileName>
<FilePattern>${LOG_DIR}system%d{...
-1
votes
0
answers
14
views
How to load both log4j2.properties and log4j2.xml files in log4j2
I have a spring 4.2 application and I am trying to migrate log4j1.x to log4j 2. We are using Configurator to load log4j.properties and log4j.xml programmatically with log4j1.x. How can I load both ...
0
votes
0
answers
15
views
How to validate log4j2.xml file to detect broken xml as well as any duplication or errors added to xml file via unit tests?
I have an XML file to configure log4j2 in my project. I am trying to find a way to write a unit test that checks the XML file for any duplication or errors. In the past, we had a duplicate config ...
0
votes
1
answer
24
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-...
0
votes
0
answers
11
views
zookeeper fails to start : java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
# sh /opt/zookeeper-3.4.13-1.hardtop.0.9.1/bin/zkServer.sh start-foreground
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper-3.4.13-1.hardtop.0.9.1/bin/../conf/zoo.cfg
Exception in thread ...
1
vote
2
answers
36
views
Log4j2 log file not created
For a spring-boot application I'm trying to set up a log4j2 logger that will write the logs into a few sperate files, but the logs are only written to the console, I've checked my user_dir to make ...
0
votes
0
answers
10
views
Turn off console logging for gitlab jobs
I have a project that uses log4j2.xml and I want to disable console logging during the job that runs through Gitlab. I'm not totally sure how to do it. Here is what my Console looks like now in my ...
0
votes
0
answers
19
views
Logging or monitoring log in attempts to JCEKS keystore
I don't know whether this is possible or not. I am currently working (experimenting) on a project that requires encryption. I use the JCEKS keystore to store my private and secret keys.
From what I ...
1
vote
1
answer
43
views
How do i catch an HTTP request header parse error thrown by Http11Processor?
I am running a spring boot application with an embedded Tomcat server on an AWS EC2 instance. I use Log4J2 to log both the spring boot logs as well as the tomcat server logs.
Tomcat will usually ...
0
votes
1
answer
12
views
log4j2 change level of root logger at runtime?
Is it possible to change the root log level at runtime?
<Loggers>
<Root level="INFO">
<AppenderRef ref="APPLICATION"/>
</Root&...
0
votes
1
answer
32
views
Log4j2 logging configuration not creating a log file
For a very basic spring-boot application, I am trying to log into a log file using log4j2 yaml configuration. But no log file is created. I have tried to look around but none of the solutions seem to ...
0
votes
0
answers
11
views
Log4j2 converting multiline logs stacktraces into single line
I'm trying to push the logs my Elasticserver logs to rsys and then FLuentd. For this the stacktrace error logs should be in one line.
It was multiline before
443 [2022-08-05T07:45:38,068][ERROR][o.e.i....
0
votes
0
answers
26
views
LOG4J2 LogManager nullpointer exception on startup app
I have one app running in an old server Solaris 10.
In this server, after migrate log4j1 to log4j2 we start to get an error while start the app.
2022-08-04 15:02:52,994 main DEBUG Stopped org.apache....
0
votes
0
answers
19
views
To use Sleuth along with log4j2
I am trying to get appName, traceid,spanid in my logs using sleuth. I am aware that it can be done using logback. But I am not able to get these using log4j2. Can somebody help me how to do this.
0
votes
0
answers
18
views
pass file name from logger to appender
i want to log out to different files because there are too many and hard to fallow. For example i have hospital application and i want separate log file for every different action like appointment, ...
0
votes
1
answer
16
views
LOG4j2 - Multiple files are saved again at the end of the process
I've been dealing with this problem for a long time, and couldn't find a solution.
I have a batch process, that consists of multiple processes, each one logging into its own file.
Problem
Files are ...
-2
votes
1
answer
57
views
Logs are getting truncated and showing this " Truncated. see log file for complete stacktrace" in weblogic console?
I am using WebLogic Console to see logs but my logs are truncated and showing this message
Truncated. see log file for complete stacktrace
How to show logs for exception stacktrace without ...
0
votes
0
answers
26
views
Add path for log file creation in java programmatically for log4j2 in xml file
I have used below xml file for the configuration of log4j2. I want to decide the path of log file creation at runtime.
How can I achieve this in spring boot?
<Configuration shutdownHook="...
0
votes
1
answer
17
views
log4j2 property substitution using Main Arguments Lookup (Application)
I am trying to follow -
https://logging.apache.org/log4j/2.x/manual/configuration.html#PropertySubstitution
https://logging.apache.org/log4j/2.x/manual/lookups.html#AppMainArgsLookup
My main class ...
0
votes
1
answer
23
views
How to get logger Hierarchy in Log4j2 ? I am migrating from Log4j1 to log4j2. Earlier we were using the Hierarchy Class to get the Hierarchy
Earlier we were doing like below :
This is code we had used to get the logger hierarchy and loggers. but now in log4j2 the Hierarchy class does not exist.
What is the alternative to achieve below in ...
0
votes
0
answers
35
views
Error while reading system.properties variable in log4j2.xml
My log4j2.xml looks like -
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="...
0
votes
1
answer
44
views
RollingAppender doesn't delete old logs (log4j2)
Here is my log4j2.yaml.
Now this logger create 1 file in day and when this day will end - the logger will create a folder "archive" and will put old log file to this folder.
I need to delete ...
0
votes
1
answer
22
views
Logs are not recorded when using external log configuration
I have Spring MVC web application deployed on tomcat. (Not Spring Boot)
I want to use external log file to have access to it during runtime. Log4j2 library.
log4j.configurationFile parameter is used ...
0
votes
2
answers
45
views
Log4j2 does not write logs to console or file (properties)
i tried to add log4j2 to my project, and i want it to write logs to the file and to the console, but no one works...
My log4j2.properties file
appenders = myfileappender,console
appender....
0
votes
0
answers
14
views
Print the log file name set in log4J2 xml in Java code
Below is my log4j2.xml'
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="LogToConsole&...
0
votes
1
answer
61
views
Does confluent kafka (cp-kafka) support Log4j RollingFileAppender with Time/Size Based Triggering Policy & Rollover Strategy? Doesn't seem to work
I am using the Confluent Community Docker Image for Apache Kafka & trying to have the Kafka logs rolled over daily with a Time & Size Based Triggering Policy & Rollover Strategy.
As ...
0
votes
0
answers
14
views
How to minify org.apache.http.wire and org.apache.http.headers log in log4j?
Is it possible to minify org.apache.http.wire and org.apache.http.headers logs?
I have something like this:
2022-07-26 09:39:50,306 DEBUG [org.apache.http.wire] (SpringContextShutdownHook) http-
...
0
votes
0
answers
32
views
Migrating log4j properties from log4j 1.x to log4j 2.x
We have migrated a few days back from log4j 1.x to log4j 2.x. But I am unable to migrate log4j.properties to log4j2.properties.
Earlier we had the file named log4j.properties in classpath with the ...
0
votes
0
answers
14
views
Logging with Embedded Jetty
I have a question related to how logging with sl4j+logback/log4j2 works in web applications deployed on some container like jetty/tomcat/etc.
We are starting our application with embedded jetty. We ...
0
votes
0
answers
19
views
Logging in different files according to request
I have a gradle project and using log4j2.xml to configure the logging and my requirement is that I have services which are important for logging and some which are not so the 1st one will log all the ...
1
vote
0
answers
42
views
Lo4j2 Logger generates empty file
I am having trouble in making this simple log4j2 sample program work
log42.properties
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG">
...
0
votes
0
answers
18
views
Easy and Best way to configure log4j in EAP 7.2.0 Java Web Application
I am having a Java Web Application. I deployed it in Jboss EAP7.2.0 and it is working fine. Now, I want to add log4j to the application and store logs in a specific folder.
Now, I am having log4j2.xml ...
0
votes
0
answers
28
views
How activate garbage-free mode in log4j2?
I need activate garbage-free mode in app. I did everything was in log4j2 doc, but i didn't see the difference. I used Java Flight Recorder to measure my app.
Code:
static void testMode() {
...
0
votes
0
answers
12
views
Lift Log4JStopWatch on log4j2
I have to migratge Log4JStopWatch. I tryed to figure out the souluten by google, but no success.
Do you have a simple solution to lift Log4JStopWatch on log4j2.
public static org.perf4j.StopWatch....
0
votes
0
answers
19
views
How to change Log level of qpid-broker-core
We are starting qpid broker from java code. Library used is qpid-broker-core, qpid-broker-plugins-amqp-1-0-protocol, qpid-broker-plugins-management-http.
Map<String, Object> attributes = new ...
0
votes
0
answers
19
views
How does Log4j2 RollingFile Delete IfAccumulatedFileCount count files?
Suppose there is the following log4j2 configuration using yaml:
Configuration:
name: Default
Properties:
Property:
name: log-path
value: "logs"
Appenders:
...
0
votes
0
answers
25
views
LogFiles/ Logs are not getting created JBOSS EAP 7.2.0 Web Application
I am using JBoss EAP 7.2.0
I have deployed many WAR files in the deployment folder. In one of the WAR files, I am trying to use log4j, but logs are not getting generated.This is the log4j.xml I am ...
0
votes
1
answer
36
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
0
answers
15
views
Set Log4j2 VM Properties with Intellij
I try to set the Logger Level with the VM Options in Intellij, but it doesn't work.
According to the documentation Docu, I tried the following:
-Dlog4j2.level=DEBUG
But it has no effect!
But when I ...
0
votes
0
answers
24
views
Need a Log4j2 appender having two policies with different filenames
I have a particular requirement where I require two ways of rolling(TimeBasedTriggeringPolicy and SizeBasedTriggeringPolicy) , and each way of rolling should create a file with a different name:
When ...
3
votes
1
answer
131
views
How to reference external log4j2 configuration file using xi:include from external library?
Tell me please, how to write path to file inside the maven dependency with my custom configuration in <xi:include href="" in log4j2 configuration?
In my application I've added following ...
0
votes
0
answers
33
views
Log4j2.17.2 xml config file in a multithreaded environment throws errors when included routing tags
Thanks for trying to help the question. I have been trying to upgrade the log4j from version 2.2.x to 2.17.2 for that I have included following starters, the spring boot version is 2.6.6 -
<...
0
votes
0
answers
21
views
How to make a log4j pattern with tabulations and remove the red logs?
I have two issues.
The first one is that when the application prints the logs, they are printed this way:
19-07-2022 09:21:15 [INFO ] TomcatWebServer [220] - Tomcat started on port(s): 8080 (http) ...
0
votes
1
answer
44
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" ...
0
votes
1
answer
39
views
Log4j2 AsyncAppenderEventDispatcher: frozen thread, potential deadlock?
YourKit warns about a potential deadlock in Log4j2's AsyncAppenderEventDispatcher:
Potential deadlock: frozen threads found
It seems that the following threads have not changed their stack for more ...