5
I am trying to configure Log4j in my project with JSF. I followed all the steps of a tutorial I found on Youtube. However, the following message is being sent:
log4j:WARN No appenders could be found for logger (br.com.hidros.control.beans.ControleBean).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
I’m using the log4j-1.2.17.jar
.
My file log4j.properties
is already in the console of the WEB-INF folder and in my class I did this:
public class ControleBean implements Serializable {
private static final long serialVersionUID = 1L;
private static final Logger log = Logger.getLogger(ControleBean.class);
And us catchso:
catch (ConnectException ex) {
contarTentativas();
System.out.println("ConnectException de ControleBean.verificarReles(Placa placa) (PLACA ="+placa.getIpPlaca()+")");
log.info("ConnectException de ControleBean.verificarReles(Placa placa)");
log.debug(ex, ex);
}
My file log4j.properties
is that way:
log4j.rootCategory=DEBUG, R, O
log4j.appender.O=org.apache.log4j.ConsoleAppender
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=log4j.log
log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.O.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n
log4j.appender.O.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n