Hi I'm using log4j api for logging purpose. When I use the following code to append to the appender, it's showing "addAppender() is undefined for the type Logger" error
FileAppender myAppender = new FileAppender(new PatternLayout(),"output.log");
Logger.getLogger(ConfigFileReader.class.getName()).addAppender(myAppender);
Can anyone tell me what should I do to debug this error?
Best Answer
Are you sure that you are importing the correct Logger class? A common error is to import java.util.Logger instead of the Logger from the log4j package.