Q:

How to solve Log4J No Such Property warning/error?

I have a Log4J xml config file with appenders in it.
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
    <param name="File" value="/tomcat/website/webapps/app/logs/appInfo.log" />
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d{MMM dd HH:mm:ss} %F: %m%n" />
    </layout>
</appender>

<appender name="rolling" class="org.apache.log4j.RollingFileAppender">
    <param nawebsite/webapps/app/logs/app.log" />
    <param name="MaxFileSize" value="1000KB" />
    <param name="MaxBackupIndex" value="2" />
    <param name="DatePattern" value="'.'yyyy-MM-dd'" />
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d{MMM dd HH:mm:ss} %F: %m%n" />
    </layout>
</appender>

When I build my project, I get the following warnings/errors in the console which I am trying to get rid of:
log4j:WARN No such property [datePattern] in org.apache.log4j.RollingFileAppender.
log4j:WARN No such property [file] in org.apache.log4j.ConsoleAppender.

I did not make these log4j config xml files; they were already part of the project.
I've seen the DatePattern documentation online, and it seems to suggest exactly what is in the DatePattern value, so I have no idea why it's still showing me that warning. Same with file.
Did the person who made this before me just stick properties in these appenders that do not belong? I'm having a difficult time verifying this.

A:

Every Appender has it's own configuration properties. file make sense for RollingFileAppender but doesn't make sense for ConsoleAppender.
If you switch one appender to another and do not update configuration properties, then you will get such warnings.
To fix them, you need to remove unused (or inapplicable) properties from your configuration:
<appender name="stdout" class="org.apache.log4j.ConsoleAppender">
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d{MMM dd HH:mm:ss} %F: %m%n" />
    </layout>
</appender>

<appender name="rolling" class="org.apache.log4j.RollingFileAppender">
    <param name="FileName" value="/tomcat/website/webapps/app/logs/app.log" />
    <param name="MaxFileSize" value="1000KB" />
    <param name="MaxBackupIndex" value="2" />
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="%d{MMM dd HH:mm:ss} %F: %m%n" />
    </layout>
</appender>

Complete list of appenders and their parameters is available on the Apache Commons Log4j webpage:
https://logging.apache.org/log4j/2.x/manual/appenders.html

