File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes log4j error message - please send solutions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "log4j error message - please send solutions" Watch "log4j error message - please send solutions" New topic

log4j error message - please send solutions

rajareddy annavaarm
Ranch Hand

Joined: Mar 15, 2007
Posts: 96
a)log4j:WARN No appenders could be found for logger (
log4j:WARN Please initialize the log4j system properly.

b)log4j:ERROR Attempted to append to closed appender named [A-LRI]

this is my log4j configuration file

log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

#this is mandatory, DO NOT CHANGE

#com.sns.member must be renamed to the package that you are working on
#e.g., com.sns.iscm.ifx.ita.common,

#The LRIA was done so that logger log4j is backward compatable

#this is mandatory, DO NOT CHANGE
#Edit only A-LRI
#log4j.appender.A-LRI.layout.ConversionPattern=%d [%c{3}] %-5p - %m%n
#log4j.appender.A-LRI.layout.ConversionPattern=%d{ISO8601} %-5p %c{3}: %L - %m%n
log4j.appender.A-LRI.layout.ConversionPattern=%d{ISO8601} %-5p %c{3}: %L - %m%n
#Edit A-LRI
#the full path MUST-BE-CHANGED

#this is mandatory, DO NOT CHANGE
#Edit only A-LRI
#set the maximum size for the log file, after which will be backup

#if the specified log file is 'lri.log', once the MaxFileSize is reached
#it will be backed up to 'lri.log.1' and so forth till the MaxBackupIndex

#When your program is going to trial or production, the mode has to be changed to INFO.
#This is to turn off the Debug messages.
[ March 16, 2007: Message edited by: Ulf Dittmer ]
Dirk Lombard

Joined: Jul 27, 2005
Posts: 18
What version of log4j are you using? Do you use a PropertyConfigurator.configure("your properties file) to get your set your properties?

SCJP 1.4<br />SCWCD 1.4
rajareddy annavaarm
Ranch Hand

Joined: Mar 15, 2007
Posts: 96
I am using log4j 1.2.8 version.I am using properties file .
Sirish Kumar Gongal Reddy
Ranch Hand

Joined: Oct 25, 2004
Posts: 109

where you are loading and initializing your file?

First you need to load your property file and then you need to call PropertyConfigurator.configure(prop); do something like,
package com.examples;

import java.util.Properties;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

public class LogManager{

// initializes the log4j stuff
Properties prop = new Properties();
prop.load(new FileInputStream(new File("C:/Documents and Settings/mkhajamiya/workspace/Examples/src/")));
}catch(Exception ex){
public Logger getLogger(Class arg0){
return Logger.getLogger(arg0);


then use above class where ever you need to do logging,do something like..

LogManager manager = new LogManager();
Logger log = manager.getLogger(YOURCLASS.class);"you are done with log4j");
log.error("Opps...error again");

Hope it will help you. Thanks!

Frank Wiesen

Joined: Aug 02, 2007
Posts: 1
Hi there,

if you create a property file "" inside the classpath (e.g.
inside the classes root directory of your project), Log4J will find and load the file automatically.
Enable logging to see, how it initializes and which file it finds/loads:
Add "-Dlog4j.debug=1" to the system properties of your JVM.

But I expect, the property "log4j.categoryFactory=..." will have no affect (except log4j tells you, it replaces the default category factory, BUT IT WON'T, because the code inside the "PropertyConfigurator" finally replacing the factory at the "Hierarchy" class was disabled with Log4J 1.13 and the method "setCategoryFactory(...)" to do so even removed from "Hierarchy" with 1.2. So it's even not possible to replace it manually anymore. With 1.3 in January there was code checked in defining a new "setLoggerFactory(...)" at Hirarchy. But there was no further alpha release of 1.3 this year, so we still have to wait, if we want to replace the default Logger/CategoryFactory...

Best Regards,
I agree. Here's the link:
subject: log4j error message - please send solutions
It's not a secret anymore!