I have a xml log4j configuration file like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="CA" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="KTS %5p [%F] - %m%n"/>
</layout>
</appender>
<appender name="EXCEPTION" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="C:\\exception.log"/>
<param name="MaxFileSize" value="20MB"/>
<param name="MaxBackupIndex" value="5"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd-MM-yyyy HH:mm:ss,SSS} KTS %5p [%F] - %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelMatchFilter">
<param name="LevelToMatch" value="ERROR"/>
<param name="AcceptOnMatch" value="true"/>
</filter>
<filter class="org.apache.log4j.varia.DenyAllFilter"/>
</appender>
<appender name="TIMER" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="C:\\timer.log"/>
<param name="MaxFileSize" value="20MB"/>
<param name="MaxBackupIndex" value="5"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd-MM-yyyy HH:mm:ss,SSS} KTS %5p [%F] - %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelMatchFilter">
<param name="LevelToMatch" value="INFO"/>
<param name="AcceptOnMatch" value="true"/>
</filter>
<filter class="org.apache.log4j.varia.DenyAllFilter"/>
</appender>
<root>
<level value="debug"/>
<appender-ref ref="CA"/>
<appender-ref ref="TIMER"/>
<appender-ref ref="EXCEPTION"/>
</root>
</log4j:configuration>
The problem I'm having is that the file's size are passing que established file size...
Any ideas why this might be happening?
Try to append log4j:configuration attribute for debug.
For example.
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="true">
<!-- something -->
</log4j:configuration>
Debug information is written to console.
Can you try assigning MaxBackupIndex first andMaxFileSize` later . If that configuration works
<appender name="TIMER" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="C:\\timer.log"/>
<param name="MaxBackupIndex" value="5"/>
<param name="MaxFileSize" value="20MB"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd-MM-yyyy HH:mm:ss,SSS} KTS %5p [%F] - %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelMatchFilter">
<param name="LevelToMatch" value="INFO"/>
<param name="AcceptOnMatch" value="true"/>
</filter>
<filter class="org.apache.log4j.varia.DenyAllFilter"/>
</appender>
Sorry, but I already solved this issue and forgot to put the response here.
The problem was beacuse when I needed to restart the application, some threads were not being destroyed, locking the log file.
Thanks for your help anyway
Related
Trying to generate a log file with date.
Below is my xml configuration for log4j. From below configuration its generated only app.log but I am expecting app.log.2020-3-1.
Can someone please help me what is the issue in my configuration?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
<appender name="consoleAppender" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
</layout>
</appender>
<appender name="file" class="org.apache.log4j.DailyRollingFileAppender">
<param name="Threshold" value="DEBUG" />
<param name="append" value="true" />
<param name="File" value="logs/app.log" />
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
</layout>
</appender>
<root>
<priority value="DEBUG"/>
<appender-ref ref="consoleAppender" />
<appender-ref ref="file" />
</root>
</log4j:configuration>
I have errorAppender and infoAppender to separate in 2 log files.
That is working, but I need to log in info file only info information.
Example:
when I call logger.error("TEST ERROR"), I don't want this showing on info file.
is there any way to disable level logs?
log4j.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="true"
xmlns:log4j='http://jakarta.apache.org/log4j/'>
<appender name="errorAppender" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/log/error.log" />
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%p] %d %c %M - %m%n" />
</layout>
<param name="Threshold" value="ERROR" />
</appender>
<appender name="infoAppender" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/log/success.log" />
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%p] %d %c %M - %m%n" />
</layout>
<param name="Threshold" value="INFO" />
</appender>
<root>
<appender-ref ref="errorAppender" />
<appender-ref ref="infoAppender" />
</root>
</log4j:configuration>
thanks to #Fildor, it is working now using LevelRangeFilter
<appender name="infoAppender" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/log/success.log" />
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%p] %d %c %M - %m%n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="INFO" />
<param name="LevelMax" value="INFO" />
<param name="AcceptOnMatch" value="true" />
</filter>
<param name="Threshold" value="INFO" />
</appender>
We have some standalone java applications that log information to log files, with log4j (it's an old version : 1.2.8).
We have set the root level to ERROR, and defined several appenders, depending on the calling module.
The odd thing is that everything is logged, regardless of the level (INFO, DEBUG, etc.). We then decided to add the -Dlog4j.debug option to the java command line to find out if there wasn't a faulty log4.xml file being loaded, and then we saw this :
log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader#64c3c749.
log4j: Trying to find [log4j.xml] using sun.misc.Launcher$AppClassLoader#64c3c749 class loader.
log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
log4j: Trying to find [log4j.properties] using context classloader sun.misc.Launcher$AppClassLoader#64c3c749.
log4j: Trying to find [log4j.properties] using sun.misc.Launcher$AppClassLoader#64c3c749 class loader.
log4j: Trying to find [log4j.properties] using ClassLoader.getSystemResource().
log4j: Could not find resource: [null].
Why does log4j log everything, even if the root level is set to ERROR, and how can the configuration be loaded while it seems that it cannot be found?
EDIT :
1) Yes, everything is logged to the correct appenders, with the correct format and file names.
2) The log4j.xml is inside a jar, specified in the classpath.
Here is the log4j.xml:
<!-- Definition des appenders par niveau de log -->
<appender name="all" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="${REP_LOG_OPE}/CA_ARBOR2010_ALL.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="80000KB"/>
<param name="MaxBackupIndex" value="2000"/>
<filter class="org.apache.log4j.varia.LevelMatchFilter">
<param name="levelToMatch" value="ERROR"/>
</filter>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd/MM/yy - HH:mm:ss,SSS} | %-1p | %c | %L | %m%n" />
</layout>
</appender>
<appender name="debug" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="${REP_LOG_OPE}/CA_ARBOR2010_DEBUG.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="80000KB"/>
<param name="MaxBackupIndex" value="2000"/>
<layout class="org.apache.log4j.SimpleLayout"/>
<filter class="org.apache.log4j.varia.LevelMatchFilter">
<param name="levelToMatch" value="DEBUG"/>
</filter>
<filter class="org.apache.log4j.varia.DenyAllFilter"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd/MM/yy - HH:mm:ss,SSS} | %-1p | %c | %L | %m%n" />
</layout>
</appender>
<appender name="info" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="${REP_LOG_OPE}/CA_ARBOR2010_INFO.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="80000KB"/>
<param name="MaxBackupIndex" value="2000"/>
<layout class="org.apache.log4j.SimpleLayout"/>
<filter class="org.apache.log4j.varia.LevelMatchFilter">
<param name="levelToMatch" value="INFO"/>
</filter>
<filter class="org.apache.log4j.varia.DenyAllFilter"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd/MM/yy - HH:mm:ss,SSS} | %-1p | %c | %L | %m%n" />
</layout>
</appender>
<appender name="warn" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="${REP_LOG_OPE}/CA_ARBOR2010_WARN.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="80000KB"/>
<param name="MaxBackupIndex" value="2000"/>
<layout class="org.apache.log4j.SimpleLayout"/>
<filter class="org.apache.log4j.varia.LevelMatchFilter">
<param name="levelToMatch" value="WARN"/>
</filter>
<filter class="org.apache.log4j.varia.DenyAllFilter"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd/MM/yy - HH:mm:ss,SSS} | %-1p | %c | %L | %m%n" />
</layout>
</appender>
<appender name="error" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="${REP_LOG_OPE}/CA_ARBOR2010_ERROR.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="80000KB"/>
<param name="MaxBackupIndex" value="2000"/>
<layout class="org.apache.log4j.SimpleLayout"/>
<filter class="org.apache.log4j.varia.LevelMatchFilter">
<param name="levelToMatch" value="ERROR"/>
</filter>
<filter class="org.apache.log4j.varia.DenyAllFilter"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd/MM/yy - HH:mm:ss,SSS} | %-1p | %c | %L | %m%n" />
</layout>
</appender>
<appender name="fatal" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="${REP_LOG_OPE}/CA_ARBOR2010_FATAL.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="80000KB"/>
<param name="MaxBackupIndex" value="2000"/>
<layout class="org.apache.log4j.SimpleLayout"/>
<filter class="org.apache.log4j.varia.LevelMatchFilter">
<param name="levelToMatch" value="FATAL"/>
</filter>
<filter class="org.apache.log4j.varia.DenyAllFilter"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd/MM/yy - HH:mm:ss,SSS} | %-1p | %c | %L | %m%n" />
</layout>
</appender>
<!-- Definition des appenders specifiques -->
<!-- MVNO 2012 -->
<appender name="mvno2012" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="${REP_LOG_OPE}/CA_MVNO2012.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="80000KB"/>
<param name="MaxBackupIndex" value="2000"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd/MM/yy - HH:mm:ss,SSS} | %-1p | %c | %t | %L | %m%n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMin" value="DEBUG"/>
<param name="levelMax" value="FATAL"/>
</filter>
</appender>
<!-- Moteur de collecte -->
<appender name="engine_collecte" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="${REP_LOG_OPE}/CA_COLLECTE_ENGINE.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="80000KB"/>
<param name="MaxBackupIndex" value="2000"/>
<layout class="org.apache.log4j.SimpleLayout"/>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMin" value="DEBUG"/>
<param name="levelMax" value="FATAL"/>
</filter>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd/MM/yy - HH:mm:ss,SSS} | %-1p | %c | %t | %L | %m%n" />
</layout>
</appender>
<!-- Utilitaires apache (org.apache ...) -->
<appender name="apache_utilities" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="${REP_LOG_OPE}/CA_APACHE_UTILITIES.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="80000KB"/>
<param name="MaxBackupIndex" value="2000"/>
<layout class="org.apache.log4j.SimpleLayout"/>
<filter class="org.apache.log4j.varia.LevelMatchFilter">
<param name="levelMin" value="DEBUG"/>
<param name="levelMax" value="FATAL"/>
</filter>
<filter class="org.apache.log4j.varia.DenyAllFilter"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd/MM/yy - HH:mm:ss,SSS} | %-1p | %c | %L | %m%n" />
</layout>
</appender>
<appender name="aruba" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="${REP_LOG_OPE}/CA_ARUBA.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="80000KB"/>
<param name="MaxBackupIndex" value="2000"/>
<layout class="org.apache.log4j.SimpleLayout"/>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMin" value="DEBUG"/>
<param name="levelMax" value="FATAL"/>
</filter>
<filter class="org.apache.log4j.varia.DenyAllFilter"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd/MM/yy - HH:mm:ss,SSS} | %-1p | %c | %L | %m%n" />
</layout>
</appender>
<appender name="fx" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="${REP_LOG_OPE}/CA_FX.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="80000KB"/>
<param name="MaxBackupIndex" value="2000"/>
<layout class="org.apache.log4j.SimpleLayout"/>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMin" value="DEBUG"/>
<param name="levelMax" value="FATAL"/>
</filter>
<filter class="org.apache.log4j.varia.DenyAllFilter"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd/MM/yy - HH:mm:ss,SSS} | %-1p | %c | %L | %m%n" />
</layout>
</appender>
<appender name="tuxedo" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="${REP_LOG_OPE}/CA_TUXEDO.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="80000KB"/>
<param name="MaxBackupIndex" value="2000"/>
<layout class="org.apache.log4j.SimpleLayout"/>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMin" value="DEBUG"/>
<param name="levelMax" value="FATAL"/>
</filter>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd/MM/yy - HH:mm:ss,SSS} | %-1p | %c | %L | %m%n" />
</layout>
</appender>
<appender name="arbor2010" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="${REP_LOG_OPE}/CA_ARBOR2010.log"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="80000KB"/>
<param name="MaxBackupIndex" value="2000"/>
<layout class="org.apache.log4j.SimpleLayout"/>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMin" value="DEBUG"/>
<param name="levelMax" value="FATAL"/>
</filter>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd/MM/yy - HH:mm:ss,SSS} | %-1p | %c{1} | %L | %X{ID} | %m%n" />
</layout>
</appender>
<logger name="com.ours.theirs.arbor2010" additivity="false">
<appender-ref ref="arbor2010"/>
</logger>
<logger name="com.ours.theirs.mvno2012" additivity="false">
<appender-ref ref="mvno2012"/>
</logger>
<logger name="com.csgsystems" additivity="false">
<appender-ref ref="aruba"/>
</logger>
<logger name="terrapin" additivity="false">
<appender-ref ref="tuxedo"/>
</logger>
<logger name="com.csgsystems.fx" additivity="false">
<appender-ref ref="fx"/>
</logger>
<logger name="com.ours.collecte" additivity="true">
<appender-ref ref="engine_collecte"/>
</logger>
<logger name="com.ours.common" additivity="false">
<appender-ref ref="engine_collecte"/>
</logger>
<logger name="org.apache" additivity="false">
<appender-ref ref="apache_utilities"/>
</logger>
<root>
<level value="ERROR"/>
<appender-ref ref="all"/>
</root>
EDIT 2 :
I still haven't found what's happening, but here is what I have found out and done so far :
1) The log4j.xml file was malformed : it was missing the DOCTYPE, there were multiple layouts, some layout classes were incorrect.
2) I have specified the path to the log4j.xml file in the command line
3) There were several calls to DOMConfigurator and PropertyConfigurator, I've removed them.
I have narrowed my research to a class that creates dynamic log files based on a thread id. Before the code in that class is executed, the log4j console logs clearly states the log level is ERROR. The moment the dynamic log files are created, the log level switches to DEBUG.
The answer is near.
EDIT 3
I've found the culprit!
A third party component loads its own log4j configuration on top of ours. It adds appenders and it changes the root logging level.
It's good to note that when a new file is loaded, log4j doesn't seem to debug that information to the console.
The root level was changed by a third party component, which loads a specific configuration.
When facing such a problem :
Check if your code doesn't contain any extra log4j dynamic configuration loading (DOMConfigurator, PropertyConfigurator)
Check if any third party component doesn't load any extra log4j configuration
Make sure your log4j.xml (or log4j.properties) is valid.
I try to make my log file more readable so I want to separate records in my log file by a blank line after every application run. I use log4j.
I understand that the easiest way is to append %m%n to a single record in code. But I'm interested in doing it via configuration file.
So the question is what I have to add to configuration file log4j.xml?
Here is the context of my log4j.xml configuration file:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="true"
>
<appender name="file" class="org.apache.log4j.RollingFileAppender">
<param name="append" value="true"/>
<param name="maxFileSize" value="10MB"/>
<param name="maxBackupIndex" value="10"/>
<param name="file" value="logs/logs.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n"/>
</layout>
</appender>
<root>
<level value="DEBUG"/>
<appender-ref ref="file"/>
</root>
</log4j:configuration>
You could use another Logger defined in your configuration that uses the same settings except its ConversionPattern which will contain only %n. Here is an example:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="true">
<appender name="file" class="org.apache.log4j.RollingFileAppender">
<param name="append" value="true"/>
<param name="maxFileSize" value="10MB"/>
<param name="maxBackupIndex" value="10"/>
<param name="file" value="logs/logs.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n"/>
</layout>
</appender>
<appender name="file2" class="org.apache.log4j.RollingFileAppender">
<param name="append" value="true"/>
<param name="maxFileSize" value="10MB"/>
<param name="maxBackupIndex" value="10"/>
<param name="file" value="logs/logs.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%n"/>
</layout>
</appender>
<logger name="com.company.MyClass">
<level value="DEBUG"/>
<appender-ref ref="file2"/>
</logger>
<root>
<level value="DEBUG"/>
<appender-ref ref="file"/>
</root>
</log4j:configuration>
Then, when your app starts:
Logger logger = Logger.getLogger(com.company.MyClass.class);
logger.info(" ");
I'm not sure to understand what you want to achieve and why, but if you want an empty line between each log entry, you just have to add an extra %n at the end of your ConversionPattern:
<param name="ConversionPattern"
value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n%n"/>
(%n means "new line")
I am using log4j for logging in my applicaion. I am trying to different level logs in different files but something going wrong. Any help regrading this issue will be highly appreciated.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %c{1} - %m%n"/>
</layout>
</appender>
<appender name="DEBUG" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="TCS_patch_9/log/retailer_debug.log" />
<param name="Threshold" value="DEBUG" />
<param name="MaxFileSize" value="2MB"/>
<param name="MaxBackupIndex" value="3"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} %-5p %c - %m%n"/>
</layout>
</appender>
<appender name="INFO" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="TCS_patch_9/log/retailer_info.log" />
<param name="Threshold" value="INFO" />
<param name="MaxFileSize" value="2MB"/>
<param name="MaxBackupIndex" value="3"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} %-5p %c - %m%n"/>
</layout>
</appender>
<appender name="ERROR" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="TCS_patch_9/log/retailer_error.log" />
<param name="Threshold" value="ERROR" />
<param name="MaxFileSize" value="2MB"/>
<param name="MaxBackupIndex" value="3"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} %-5p %c - %m%n"/>
</layout>
</appender>
<appender name="FATAL" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="TCS_patch_9/log/retailer_repeat_delay.log" />
<param name="Threshold" value="FATAL" />
<param name="MaxFileSize" value="2MB"/>
<param name="MaxBackupIndex" value="3"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} %-5p %c - %m%n"/>
</layout>
</appender>
<root>
<priority value ="error" />
<appender-ref ref="console"/>
<appender-ref ref="DEBUG"/>
<appender-ref ref="INFO"/>
<appender-ref ref="ERROR"/>
<appender-ref ref="FATAL"/>
</root>
</log4j:configuration>
The standard behaviour for log4j appenders is that they log all messages at their threshold level or higher, i.e. an appender with threshold INFO will log INFO, WARN, ERROR and FATAL messages but not DEBUG. If you want to log only INFO messages but not WARN and above then you need to use a LevelMatchFilter.
You will also need to set your root logger priority to DEBUG, otherwise it will only send ERROR and FATAL messages to its appenders and your DEBUG and INFO files will be empty.