Sorry, Small Correction to my previous email
I want to attach Appender, layouts to a Logger without using log4j.prop file . I tried the below ________________________________ From: ITN (Babu Easwaramoorthy) [mailto:[EMAIL PROTECTED] Sent: Sunday, May 28, 2006 3:21 PM To: log4j-user@logging.apache.org Subject: Logger Initilization Hi I do want to attach an Appender, layouts to a Logger without using log4j.prop file . I tried the below I initialized the Logger (the name of the logger is the log file name) in the constructor by setting DailyRollingFileAppender to the Logger as below. Next time in the JVM when I try to create the same Logger (in the Log method) with the file name I am not getting the Logger instance to which I attached the DailyRollingFileAppender. I am getting different instance and getting appender could not be found message. Can any one help to understand this Below is the source code. Thanks in advance, Babu import org.apache.log4j.Logger; import org.apache.log4j.Level; import org.apache.log4j.Layout; import org.apache.log4j.PatternLayout; import org.apache.log4j.DailyRollingFileAppender; public class EBEAILogger { private EBEAILogger() {} public static final int OFF = 0; public static final int FATAL=1; public static final int ERROR=2; public static final int WARN=3; public static final int INFO=4; public static final int DEBUG = 5; public static final int ALL =6; static final String datePattern = "yyyy-MM-dd.'log'"; static final String logPattern = "%d %-2p [%c{3}] - %m - [%F:%M:%L] %n"; public EBEAILogger(String fileName) { try { Layout layout = new PatternLayout(logPattern); DailyRollingFileAppender appender = new DailyRollingFileAppender(layout, fileName, datePattern); private static Logger logger = Logger.getLogger(fileName); logger.addAppender(appender); }catch(Exception e) { e.printStackTrace(); } } public static void log(String fileName, String message,int logLevel) { Logger logger = Logger.getLogger(fileName); switch (logLevel) { case DEBUG: logger.debug(message); break; case WARN : logger.warn(message); break; case INFO : logger.info(message); break; case ERROR: logger.error(message); break; case FATAL: logger.fatal(message); break; } } } DISCLAIMER: This Electronic Mail and any attached information are confidential and may also be privileged. It is intended only for the use of authorized persons. If you are not an addressee, or have received the message in error, you are not authorized to read, copy, disseminate, distribute or use the Electronic Mail or any attachment in any way. Please notify the sender by return E-Mail or over the telephone and delete this e-mail Click here <https://www.mailcontrol.com/sr/wQw0zmjPoHdJTZGyOCrrhg== !kj8IOPJqx8hno0+aXgtUt4CXIRpbZwjNQRIbDx3r68NNUK1Y8tLw+JHxe!ccixr!zRpo40x QMW7yA!73!mXV07nSMPzVZJOfMCQtii415UeeORdSgS1arGQM5r6IZaNaONeWlHrANCpzr4g lwilZeJ+cZnrulpjaeAJnVcBZr5nCil1jpaPNlJ6> to report this email as spam.