log4j2 not writing to the log file with rollingFile appenders


Hi i am new using log4j

I am trying to configure the xml to send those logging into the log file using the and appender, well, the appender works fine so i want to use appender so that it will clear the log file daily, but when it first created the log file, it doesn't write any log message into the file created by , so i come here to get some advise

<?xml version="1.0" encoding="UTF-8"?> <Configuration status="FATAL" > <Appenders> <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="${pattern}" /> </Console> <RollingFile name="rollingfile" fileName="rolling.log" filePattern="rolling-%d{MM-dd-yyyy}.log"> <PatternLayout pattern="${pattern}" /> <Policies> <TimeBasedTriggeringPolicy interval="1" modulate="true" /> <SizeBasedTriggeringPolicy size="10 MB" /> </Policies> </RollingFile> <File name="file" fileName="test2.log"> <PatternLayout pattern="${pattern}" /> </File> </Appenders> <Loggers> <Root level="trace" > <AppenderRef ref="Console" /> <AppenderRef ref="rollingfile" /> <AppenderRef ref="file" /> </Root> </Loggers> </Configuration>


You have AppenderRef="rolling", but your Appender is named "rollingfile". These need to match.

Also, log4j probably issues a warning that there is a problem with the configuration. I recommend you specify <Configuration status="WARN" > at the start of your config instead of FATAL so that you can see these warnings.

It may be that you need to specify ${sys:pattern} to read the system property. Instead of the ${pattern} variable, first try an explicit pattern like %d %p [%t] %m%n.


  • Where to write log for Windows app
  • handle AVL messages with iodine
  • Log4J 2 not writing into file
  • Java JSON library that supports DOM-style access
  • In log4j2, how to configure renameEmptyFiles to be false for the RollingFile appender?
  • Cannot find the log4j siftAppender output logs
  • Counting how many times in a row the result of a sum is positive (or negative)
  • Using Properties in Log4J2 YAML
  • Bundle install fails - Gem using github url - What is wrong?
  • Doctrine: UniqueEntity with Many-to-Many field
  • Error processing multiple files
  • Can't remove headers after they are sent
  • Spring Cloud Microservice Architecture Confusion
  • JBoss External Properties Files in Classpath
  • Eloquent paginate function in Slim 3 project using twig
  • How to use JavaScript to determine whether a file exists in a directory?
  • Android - Material Design - NavigationView - How to put vertical scroll?
  • Why Encoding.ASCII != ASCIIEncoding.Default in C#?
  • How do I pass the string value parameter of the selected list item from an auto-populated dropdown l
  • Jquery UI tool tip close icon
  • How can I send an e-mail from a vbs script
  • Encrypt data by using a public key in c# and decrypt data by using a private key in php
  • SSO with signing and signature validation doesn't work
  • Shallow update not allowed (git > 1.9)
  • Deserializing XML into class C#
  • Can I have the cursor start on a particular column by default in jqgrid's edit mode?
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • Upload files with Ajax and Jquery
  • jquery mobile loadPage not working
  • How to pass list parameters for each object using Spring MVC?
  • Is there a mandatory requirement to switch app.yaml?
  • How to include full .NET prerequisite for Wix Burn installer
  • Proper way to use connect-multiparty with express.js?
  • Qt: Run a script BEFORE make
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?