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 Ralph Goers <ra...@dslextreme.com> on 2021/10/29 22:46:29 UTC

Re: Providing library defaults

I’m not sure I completely understand the question 
* I’m not sure what you mean by “additive default configuration”. Certainly you can have a default configuration. Use you can add to it.
* Don’t log by default would mean that both onMatch and onMismatch are set to DENY

Ralph

> On Oct 29, 2021, at 3:20 PM, Marius Volkhart <Ma...@volkhart.com> wrote:
> 
> Hello all,
> 
> I’m authoring a library that uses the Log4j API for internal logging. I want to provide my users valuable logging, but only under some circumstances. For example, if an expensive initializer gets called frequently, log a message indicating a possible performance impact. Or if logging something that may contain sensitive data, only logging it if they opt-in.
> 
> I would typically solve this at the application layer using Filters. A ThresholdFilter and a MarkerFilter for example. Is there a way to provide an additive default configuration for my users? Or some other mechanism for saying “don’t log by default”? Or perhaps differently, am I wrong for thinking about the problem/solution this way?
> 
> Thanks in advance!
> 
> 
> Cheers,
> Marius 
> ---------------------------------------------------------------------
> 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


Re: Providing library defaults

Posted by Gary Gregory <ga...@gmail.com>.
You can use different logger names, different logger levels, and markers.
With these three levers, you can provide an incredible amount of
flexibility.

Gary

On Fri, Oct 29, 2021, 18:47 Ralph Goers <ra...@dslextreme.com> wrote:

> I’m not sure I completely understand the question
> * I’m not sure what you mean by “additive default configuration”.
> Certainly you can have a default configuration. Use you can add to it.
> * Don’t log by default would mean that both onMatch and onMismatch are set
> to DENY
>
> Ralph
>
> > On Oct 29, 2021, at 3:20 PM, Marius Volkhart <Ma...@volkhart.com>
> wrote:
> >
> > Hello all,
> >
> > I’m authoring a library that uses the Log4j API for internal logging. I
> want to provide my users valuable logging, but only under some
> circumstances. For example, if an expensive initializer gets called
> frequently, log a message indicating a possible performance impact. Or if
> logging something that may contain sensitive data, only logging it if they
> opt-in.
> >
> > I would typically solve this at the application layer using Filters. A
> ThresholdFilter and a MarkerFilter for example. Is there a way to provide
> an additive default configuration for my users? Or some other mechanism for
> saying “don’t log by default”? Or perhaps differently, am I wrong for
> thinking about the problem/solution this way?
> >
> > Thanks in advance!
> >
> >
> > Cheers,
> > Marius
> > ---------------------------------------------------------------------
> > 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
>
>