Hi all,

I have a java program when I compile it, it compiles fine, without any error or warning. However, when I run it, I get the following warnings.

bash-2.03$ javac CountSessions.java
bash-2.03$ java CountSessions
Writing data to file...
Data written to file !!
log4j:WARN No such property [maxFileSize] in org.apache.log4j.DailyRollingFileAppender.
log4j:WARN No such property [maxBackupIndex] in org.apache.log4j.DailyRollingFileAppender.

I am wondering, if this warning is critical? and what is it about?

Appreciate your comments,

Thanks and regards.

The warning is not critical.

Where are you defining log4j configuration ? i mean in your program or in XML config file or *.properties file ?

If asynchronous logging is a requirement, then the xml properties file you have to use.

if you are using something like log4j.appender.A2.MaxFileSize=1000KB
or something like that then it means that you want to rollover your file after every 1000KB

It will be better if you post your configuration details so i can help you to remove the warning.

Hi Below is the code. Please help me to remove the warning. Due to warnings, the log4j is not writing any logs to specified file.

<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<!-- appenders -->
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
 <appender name="dataservices" class="org.apache.log4j.DailyRollingFileAppender">
  <param name="DatePattern" value="'.'yyyy-MM-dd"/>
  <param name="File" value="${catalina.home}/logs/mediaapi/MediaDataService.log"/>
  <!-- <param name="MaxFileSize" value="10MB"/>-->
  <param name="MaxBackupIndex" value="100"/>
  <layout class="org.apache.log4j.PatternLayout">
   <param name="ConversionPattern" value="[%t] %d{HH:mm:ss,SSS} %-5p %l - %m%n"/>
   <!-- Above conversionPattern is applied so that time of statement can be known.
    As DailyFileRollingAppender is used, the file name will contain date. -->
   <!-- "%d{${yyyy-MM-dd HH:mms}} [%t] %-5p %c - %m%n} [%t] %-5p %c - %m%n" />-->
  </layout>
 </appender>

 <appender name="stdout" class="org.apache.log4j.ConsoleAppender">
  <param name="Target" value="System.out"/>
  <param name="File" value="${catalina.home}/logs/mediaapi/MediaDataService.log"/>
  <!-- <param name="MaxFileSize" value="10MB"/>-->
  <param name="MaxBackupIndex" value="100"/>
  <layout class="org.apache.log4j.PatternLayout">
   <param name="ConversionPattern" value="%d{ABSOLUTE} %5p %c{1}:%L - %m%n" />
  </layout>
 </appender>
 <!-- loggers -->
 <logger name="com.nielsen.media">
  <level value="info"></level> 
 </logger>
 <logger name="com.nielsen.media.dataservices.tibco">
  <level value="info"></level> 
 </logger>
 <logger name="com.nielsen.media.dataservices.common.utils">
  <level value="info"></level> 
 </logger>
 <logger name="org.apache.commons.beanutils">
  <level value="info"></level> 
 </logger>
 <!-- root logger -->
 <root>
  <level value="info" ></level>
  <appender-ref ref="dataservices" ></appender>
  <appender-ref ref="stdout" ></appender>
 </root>
This article has been dead for over six months. Start a new discussion instead.