RE: activateOptions() in RollingFileAppender
No. You should call it in code after having assigned new values to appender properties. Heri -Original Message- From: Rahul [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 07, 2006 3:20 PM To: log4j-user@logging.apache.org Subject: activateOptions() in RollingFileAppender Hi all, I want to change the log file of my application at runtime, for which I need to call activateOptions() on RollingFileAppender. This is how my log4j.xml looks like: log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; appender name=appender class=org.apache.log4j.RollingFileAppender param name=File value=/home/rahul/mylog.log/ param name=Append value=true/ * param name=activateOptions() value=true /* param name=MaxFileSize value=500KB/ param name=MaxBackupIndex value=1/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %c %x -%m%n/ !-- param name=ConversionPattern value=%d [%t] %-5p %c %x -%m%n/ -- !--param name=ConversionPattern%d [%t] %p - %m%n -- /layout /appender root priority value =WARN/ appender-ref ref=appender/ /root /log4j:configuration Is this the correct way of passing activateOptions to the RollingFileAppender? If not then how can I do that? -Rahul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: activateOptions() in RollingFileAppender
I am using log4j in my struts application. And only code I have written in my classes is Logger logger=Logger.getLogger(ClassName.class); which creates a logger instance then logger.info(some log); Where should I call activateOptions() and how to invoke that piece of code? Bender Heri wrote: No. You should call it in code after having assigned new values to appender properties. Heri -Original Message- From: Rahul [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 07, 2006 3:20 PM To: log4j-user@logging.apache.org Subject: activateOptions() in RollingFileAppender Hi all, I want to change the log file of my application at runtime, for which I need to call activateOptions() on RollingFileAppender. This is how my log4j.xml looks like: log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; appender name=appender class=org.apache.log4j.RollingFileAppender param name=File value=/home/rahul/mylog.log/ param name=Append value=true/ * param name=activateOptions() value=true /* param name=MaxFileSize value=500KB/ param name=MaxBackupIndex value=1/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %c %x -%m%n/ !-- param name=ConversionPattern value=%d [%t] %-5p %c %x -%m%n/ -- !--param name=ConversionPattern%d [%t] %p - %m%n -- /layout /appender root priority value =WARN/ appender-ref ref=appender/ /root /log4j:configuration Is this the correct way of passing activateOptions to the RollingFileAppender? If not then how can I do that? -Rahul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: activateOptions() in RollingFileAppender
In your first request you said you want to change the log file of my application at runtime. The activateOptions() should be called there. If you dont really change this in your code, then I dont understand your question. You have to explain more. (but I have no idea of struts). Heri -Original Message- From: Rahul [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 07, 2006 3:29 PM To: Log4J Users List Subject: Re: activateOptions() in RollingFileAppender I am using log4j in my struts application. And only code I have written in my classes is Logger logger=Logger.getLogger(ClassName.class); which creates a logger instance then logger.info(some log); Where should I call activateOptions() and how to invoke that piece of code? Bender Heri wrote: No. You should call it in code after having assigned new values to appender properties. Heri -Original Message- From: Rahul [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 07, 2006 3:20 PM To: log4j-user@logging.apache.org Subject: activateOptions() in RollingFileAppender Hi all, I want to change the log file of my application at runtime, for which I need to call activateOptions() on RollingFileAppender. This is how my log4j.xml looks like: log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; appender name=appender class=org.apache.log4j.RollingFileAppender param name=File value=/home/rahul/mylog.log/ param name=Append value=true/ * param name=activateOptions() value=true /* param name=MaxFileSize value=500KB/ param name=MaxBackupIndex value=1/ layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p %c %x -%m%n/ !-- param name=ConversionPattern value=%d [%t] %-5p %c %x -%m%n/ -- !--param name=ConversionPattern%d [%t] %p - %m%n -- /layout /appender root priority value =WARN/ appender-ref ref=appender/ /root /log4j:configuration Is this the correct way of passing activateOptions to the RollingFileAppender? If not then how can I do that? -Rahul - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: activateOptions() in RollingFileAppender
On Feb 7, 2006, at 8:21 AM, Bender Heri wrote: No. You should call it in code after having assigned new values to appender properties. Heri When configuring log4j using a configuration file, you are not responsible for calling activateOptions(), the configuration file reader will call it for you. You would only need to call activateOptions() if you were constructing and configuring components in your Java source code. In that case, you would construct the object, set the appropriate properties and then call activateOptions () before you connected it to the configuration. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: activateOptions() in RollingFileAppender
Hi Curt, You said when configuration file (log4j.xml in my case) is used for configuring log4j, the configuration file reader will call the activateOptions(). But what needs to be written in configuration file which will tell the configuration file reader to call activateOptions() ? I did that by giving an additional parameter under RollingFileAppender as: param name=activateOptions() value=true / but its not working any suggestion? Curt Arnold wrote: On Feb 7, 2006, at 8:21 AM, Bender Heri wrote: No. You should call it in code after having assigned new values to appender properties. Heri When configuring log4j using a configuration file, you are not responsible for calling activateOptions(), the configuration file reader will call it for you. You would only need to call activateOptions() if you were constructing and configuring components in your Java source code. In that case, you would construct the object, set the appropriate properties and then call activateOptions() before you connected it to the configuration. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: activateOptions() in RollingFileAppender
On Feb 7, 2006, at 10:48 PM, Rahul wrote: Hi Curt, You said when configuration file (log4j.xml in my case) is used for configuring log4j, the configuration file reader will call the activateOptions(). But what needs to be written in configuration file which will tell the configuration file reader to call activateOptions() ? Nothing. The configurator will create the appender in response to the appender tag, process all the param tags by calling the corresponding set methods and then call activateOptions() when it encounters the /appender end tag. I did that by giving an additional parameter under RollingFileAppender as: param name=activateOptions() value=true / but its not working any suggestion? Take it out. It is interpreting that as a request to call a method with the illegal name setActivateOptions(). That will throw an exception and I'm not sure that the rest of the configuration file will be processed. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]