You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2018/01/21 19:53:56 UTC

[log4j] A better log4j2.debug

Hi All,

I want to toggle between different status levels on the command line
and log4j2.debug can't do that.

How about adding log4j2.status=level ?

Gary

Re: [log4j] A better log4j2.debug

Posted by Remko Popma <re...@gmail.com>.
Gary,

If you’re looking for a “to accomplish X, do Y”, see the FAQ. 
https://logging.apache.org/log4j/2.x/faq.html#troubleshooting

(Shameless plug) Every java main() method deserves http://picocli.info

> On Jan 23, 2018, at 5:46, Gary Gregory <ga...@gmail.com> wrote:
> 
> On Mon, Jan 22, 2018 at 12:49 PM, Ralph Goers <ra...@dslextreme.com>
> wrote:
> 
>> Properties on the command line should override configurations in files.
>> 
> 
> +1
> 
> Gary
> 
> 
>> Ralph
>> 
>>> On Jan 22, 2018, at 12:38 PM, Matt Sicker <bo...@gmail.com> wrote:
>>> 
>>> On 22 January 2018 at 13:22, Gary Gregory <ga...@gmail.com>
>> wrote:
>>>> 
>>>> Yikes. What I want to do is use a -D on the command line instead of
>> editing
>>>> the status attribute in an XML configuration file.
>>>> 
>>> 
>>> Right, that makes sense. Would this property override the config file or
>>> the other way around?
>>> 
>>> 
>>>> The docs for log4j2.defaultStatusLevel and log4j2.statusLoggerLevel are
>>>> very confusing IMO. I suppose I'll have to try both. Can these docs be
>>>> improved with an intro sentence for each saying "To do X, use Y"?
>>>> 
>>> 
>>> Agreed. I'm not entirely sure what combo would make sense, so I'd
>> probably
>>> just set all three properties to be safe.
>>> 
>>> 
>>> --
>>> Matt Sicker <bo...@gmail.com>
>> 
>> 
>> 

Re: [log4j] A better log4j2.debug

Posted by Gary Gregory <ga...@gmail.com>.
On Mon, Jan 22, 2018 at 12:49 PM, Ralph Goers <ra...@dslextreme.com>
wrote:

> Properties on the command line should override configurations in files.
>

+1

Gary


> Ralph
>
> > On Jan 22, 2018, at 12:38 PM, Matt Sicker <bo...@gmail.com> wrote:
> >
> > On 22 January 2018 at 13:22, Gary Gregory <ga...@gmail.com>
> wrote:
> >>
> >> Yikes. What I want to do is use a -D on the command line instead of
> editing
> >> the status attribute in an XML configuration file.
> >>
> >
> > Right, that makes sense. Would this property override the config file or
> > the other way around?
> >
> >
> >> The docs for log4j2.defaultStatusLevel and log4j2.statusLoggerLevel are
> >> very confusing IMO. I suppose I'll have to try both. Can these docs be
> >> improved with an intro sentence for each saying "To do X, use Y"?
> >>
> >
> > Agreed. I'm not entirely sure what combo would make sense, so I'd
> probably
> > just set all three properties to be safe.
> >
> >
> > --
> > Matt Sicker <bo...@gmail.com>
>
>
>

Re: [log4j] A better log4j2.debug

Posted by Ralph Goers <ra...@dslextreme.com>.
Properties on the command line should override configurations in files.

Ralph

> On Jan 22, 2018, at 12:38 PM, Matt Sicker <bo...@gmail.com> wrote:
> 
> On 22 January 2018 at 13:22, Gary Gregory <ga...@gmail.com> wrote:
>> 
>> Yikes. What I want to do is use a -D on the command line instead of editing
>> the status attribute in an XML configuration file.
>> 
> 
> Right, that makes sense. Would this property override the config file or
> the other way around?
> 
> 
>> The docs for log4j2.defaultStatusLevel and log4j2.statusLoggerLevel are
>> very confusing IMO. I suppose I'll have to try both. Can these docs be
>> improved with an intro sentence for each saying "To do X, use Y"?
>> 
> 
> Agreed. I'm not entirely sure what combo would make sense, so I'd probably
> just set all three properties to be safe.
> 
> 
> -- 
> Matt Sicker <bo...@gmail.com>



Re: [log4j] A better log4j2.debug

Posted by Matt Sicker <bo...@gmail.com>.
On 22 January 2018 at 13:22, Gary Gregory <ga...@gmail.com> wrote:
>
> Yikes. What I want to do is use a -D on the command line instead of editing
> the status attribute in an XML configuration file.
>

Right, that makes sense. Would this property override the config file or
the other way around?


> The docs for log4j2.defaultStatusLevel and log4j2.statusLoggerLevel are
> very confusing IMO. I suppose I'll have to try both. Can these docs be
> improved with an intro sentence for each saying "To do X, use Y"?
>

Agreed. I'm not entirely sure what combo would make sense, so I'd probably
just set all three properties to be safe.


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

Re: [log4j] A better log4j2.debug

Posted by Gary Gregory <ga...@gmail.com>.
On Mon, Jan 22, 2018 at 12:15 PM, Matt Sicker <bo...@gmail.com> wrote:

> There are some related properties to what you're proposing already:
>
> log4j2.simplelogStatusLoggerLevel
> log4j2.defaultStatusLevel
> log4j2.statusLoggerLevel
>
> Though it's a bit confusing setting them here since some of these
> properties get overridden by the configuration file or only apply in
> certain life cycles.
>
> Are you proposing a unified property that overrides everything globally? Or
> would the status attribute of the configuration element take precedence?
>

Yikes. What I want to do is use a -D on the command line instead of editing
the status attribute in an XML configuration file.

The docs for log4j2.defaultStatusLevel and log4j2.statusLoggerLevel are
very confusing IMO. I suppose I'll have to try both. Can these docs be
improved with an intro sentence for each saying "To do X, use Y"?

Gary


>
> On 21 January 2018 at 13:53, Gary Gregory <ga...@gmail.com> wrote:
>
> > Hi All,
> >
> > I want to toggle between different status levels on the command line
> > and log4j2.debug can't do that.
> >
> > How about adding log4j2.status=level ?
> >
> > Gary
> >
>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>

Re: [log4j] A better log4j2.debug

Posted by Matt Sicker <bo...@gmail.com>.
There are some related properties to what you're proposing already:

log4j2.simplelogStatusLoggerLevel
log4j2.defaultStatusLevel
log4j2.statusLoggerLevel

Though it's a bit confusing setting them here since some of these
properties get overridden by the configuration file or only apply in
certain life cycles.

Are you proposing a unified property that overrides everything globally? Or
would the status attribute of the configuration element take precedence?

On 21 January 2018 at 13:53, Gary Gregory <ga...@gmail.com> wrote:

> Hi All,
>
> I want to toggle between different status levels on the command line
> and log4j2.debug can't do that.
>
> How about adding log4j2.status=level ?
>
> Gary
>



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