logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bender Heri" <HBen...@Ergonomics.ch>
Subject RE: activateOptions() in RollingFileAppender
Date Tue, 07 Feb 2006 14:52:22 GMT
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:rahul@amsoft.net]
> 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:rahul@amsoft.net]
> >> 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: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
> >   
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message