Are you programmatically adding the Appender? I suggest the reconfiguration method because it allows for gracefully switching to a new configuration. Some appenders need fields to remain immutable for performance or safety reasons, so creating a new Appender on reconfigure is generally the safer option.
On 26 August 2014 02:43, Clément Guillaume <cguilla...@hotpads.com> wrote: > Yes, I know that. > So if I have 10 LoggerConfigs that use the same Appender and I want to > change a property of this Appender, I should create a new one and update > the appender list (remove the old one and add the new one) of my 10 > LoggerConfigs? > There isn't a simpler way, is there? > > Clément > > > On Mon, Aug 25, 2014 at 8:58 PM, Matt Sicker <boa...@gmail.com> wrote: > > > If you reconfigure Log4j at runtime, you can switch over to a new > > LoggerConfig without losing any messages. If you're holding direct > > references to LoggerConfig, you should probably step back a level and get > > that on demand instead. > > > > > > On 25 August 2014 14:22, Clément Guillaume <cguilla...@hotpads.com> > wrote: > > > > > Hi, > > > > > > I would love to have a direct access to the target of a ConsoleAppender > > (as > > > I can directly get the fileName of a FileAppender). Do you plan to > > > implement this feature ? (and also for others properties like > > > ConsoleAppender.isFollow or FileAppender.immediateFlush, ...) > > > > > > > > > I also would love to be able to dynamically update thess properties. I > > > don't think it is currently possible. > > > Or at least I would like to be able to replace an Appender in the > > > Configuration (by a new one) without removing the Appender from all the > > > previously associated LoggerConfig. > > > > > > Regards, > > > > > > Clément > > > > > > > > > > > -- > > Matt Sicker <boa...@gmail.com> > > > -- Matt Sicker <boa...@gmail.com>