On Aug 26, 2008, at 10:02 AM, Reza Razavipour wrote:
Thanks for the response. When I try it, I get null for Appender. Any thoughts on why? The code is as follows: jboss-log4j.xml has <appender name="XXX_LOG_FILE" class="org.jboss.logging.appender.DailyRollingFileAppender"> <param name="File" value="${jboss.home.dir}/bin/log/xxxx"/> <param name="Append" value="true"/> <param name="DatePattern" value="'.'yyyy-MM-dd'.log'"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %m%n"/> </layout> </appender> at runtime I have import org.apache.log4j.Appender; import org.apache.log4j.Logger; private static Logger log = Logger.getLogger(MyClass.class); in the constructor, I have Appender serverAppender = log.getAppender(""XXX_LOG_FILE"); if (serverAppender != null) { String name = serverAppender.getName(); } serverAppender is always null. Any thoughts on this? Thanks Reza
Logger.getAppender(String) returns the appender that is attached to the logger and has that name. Your appender is named "XXX_LOG_FILE" but is not attached to the logger you specified, so it returns null.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]