You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Clément Guillaume <cg...@hotpads.com> on 2014/08/25 21:22:06 UTC

Appenders

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

Re: Appenders

Posted by Clément Guillaume <cg...@hotpads.com>.
Yes, I'm programmatically adding appenders. I understand the point of view.

And what about having access to the properties of the appender as the
target of the ConsoleLogger? I know that this property is wrapped into an
OutputStream and into a OutputStreamManager but I think it could be nice to
have access to it from the ConsoleAppender.

Clément


On Wed, Aug 27, 2014 at 6:43 PM, Matt Sicker <bo...@gmail.com> wrote:

> 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 <cg...@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 <bo...@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 <cg...@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 <bo...@gmail.com>
> > >
> >
>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>

Re: Appenders

Posted by Matt Sicker <bo...@gmail.com>.
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 <cg...@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 <bo...@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 <cg...@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 <bo...@gmail.com>
> >
>



-- 
Matt Sicker <bo...@gmail.com>

Re: Appenders

Posted by Clément Guillaume <cg...@hotpads.com>.
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 <bo...@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 <cg...@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 <bo...@gmail.com>
>

Re: Appenders

Posted by Matt Sicker <bo...@gmail.com>.
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 <cg...@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 <bo...@gmail.com>