I have a Log4J config issue that I cannot get working on Wildfly/Jboss7. At runtime, I get the error:
7:02:33,517 ERROR [stderr] (default task-1) log4j:WARN No appenders could be found for logger (za.co.fnb.Test).
7:02:33,517 ERROR [stderr] (default task-1) log4j:WARN Please initialize the log4j system properly.
7:02:33,517 ERROR [stderr] (default task-1) log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
The error occurs when this line of code is executed in the class za.co.fnb.Test:
- private static org.apache.log4j.Logger log = Logger.getLogger(Test.class)
Most threads say that is because the log4j.properties or log4j.xml file is not on the server classpath, however, I have set the location of the file on the server VM and hence when my server starts it prints the location of the file:
===============================================================================
JBoss Bootstrap Environment
JBOSS_HOME: "C:\Java_Application_Servers\wildfly-8.0.0.Final"
JAVA: "C:\Program Files\Java\jdk1.7.0_21\bin\java"
JAVA_OPTS: "-XX:+UseCompressedOops -Dprogram.name=standalone.bat -Xms64M -Xmx512M -XX:MaxPermSize=256M -Dlog4j.configuration=C:\Java_Application_Servers\wildfly-8.0.0.Final\standalone\configuration\log4j.properties -Djava.net.preferIPv4St
ack=true -Djboss.modules.system.pkgs=org.jboss.byteman"
I have attached my log4j.properties file and I am thinking that I am missing something in it related to defining the appender for the logger, za.co.fnb.test.