Re: range filter?

2015-08-25 Thread Ralph Goers
I am not sure why Remko advised you to do it this way. The first filter will deny Warn, error and fatal making the next two filters redundant. The third filter will accept events at level info and deny trace and debug. So the end result is the only events that will get logged will be those at

Re: range filter?

2015-08-25 Thread Remko Popma
I see. I didn't know you could nest filters inside an AppenderRef. Nice! Sent from my iPhone On 2015/08/26, at 12:21, Ralph Goers ralph.go...@dslextreme.com wrote: If you only want info events then you should do Filters ThresholdFilter level=“warn” onMatch=“DENY” onMisMatch=“NEUTRAL”/

Re: redefining existing levels?

2015-08-25 Thread Gary Gregory
On Tue, Aug 25, 2015 at 7:59 PM, Remko Popma remko.po...@gmail.com wrote: How are users currently able to set the log level to OFF? Do they modify the config? Right, isn't the only way to enforce this is to override the config file programatically? Gary Sent from my iPhone On

Re: range filter?

2015-08-25 Thread Gary Gregory
I've got to say that I use MarkerFilters all the time, but I still need to refresh my brain when I've not used them in a while. If providing a LevelRangeFilter would be less confusing, then perhaps we should write one. Gary On Tue, Aug 25, 2015 at 7:09 PM, Nicholas Duane nic...@msn.com wrote:

Re: range filter?

2015-08-25 Thread Ralph Goers
I just did. Ralph On Aug 25, 2015, at 9:12 PM, Nicholas Duane nic...@msn.com wrote: That's exactly the use case I'm looking for. I'll have to study it some more. Can you give me an example which filters out everything but INFO? Thanks,Nick Original message From:

RE: range filter?

2015-08-25 Thread Nicholas Duane
That's exactly the use case I'm looking for.  I'll have to study it some more.   Can you give me an example which filters out everything but INFO? Thanks,Nick Original message From: Remko Popma remko.po...@gmail.com Date: 08/25/2015 9:06 PM (GMT-07:00) To: Log4J Users List

RE: redefining existing levels?

2015-08-25 Thread Nicholas Duane
It just dawned on me that my solution of redefining OFF to the INFO level only addresses the case of someone setting the level to OFF. Someone could set the level to ERROR. As I mentioned, what I'm trying to do is enforce, via configuration only, not being able to turn of logging of INFO and

Re: redefining existing levels?

2015-08-25 Thread Remko Popma
How are users currently able to set the log level to OFF? Do they modify the config? Sent from my iPhone On 2015/08/26, at 11:35, Nicholas Duane nic...@msn.com wrote: It just dawned on me that my solution of redefining OFF to the INFO level only addresses the case of someone setting the

Re: range filter?

2015-08-25 Thread Ralph Goers
If you only want info events then you should do Filters ThresholdFilter level=“warn” onMatch=“DENY” onMisMatch=“NEUTRAL”/ ThresholdFilter level=“info” onMatch=“ACCEPT” onMisMatch=“DENY”/ /Filters If you want to illustrate the other use case you would need a configuration like root

Re: range filter?

2015-08-25 Thread Remko Popma
The StackOverflow link was an answer to the question how to send _only_ INFO level events to an appender. I thought it would illustrate how filters combinations could be used to achieve the original request: I might want all DEBUG, TRACE and VERBOSE events going to one appender. All INFO,

Re: range filter?

2015-08-25 Thread Gary Gregory
Right, the hard part is explaining how to use it, combine it, and how put all the puzzle pieces together.  Gary  Original message From: Ralph Goers ralph.go...@dslextreme.com Date: 08/25/2015 21:28 (GMT-08:00) To: Log4J Users List log4j-user@logging.apache.org Subject: Re:

RE: redefining existing levels?

2015-08-25 Thread Nicholas Duane
Thanks. I assumed my 'BUSINESS' level is working using the CustomLevel, though I haven't tried it yet as I was trying to validate redefining existing level. Thanks, Nick Date: Tue, 25 Aug 2015 14:32:01 -0700 Subject: Re: redefining existing levels? From: garydgreg...@gmail.com To:

Re: range filter?

2015-08-25 Thread Ralph Goers
I believe two threshold filters inside a composite filter should should work provided you have the onMatch and onMismatch set appropriately. Ralph On Aug 25, 2015, at 12:36 PM, Nicholas Duane nic...@msn.com wrote: I'm looking for a range filter in log4j2. I see there is on in log4net and

range filter?

2015-08-25 Thread Nicholas Duane
I'm looking for a range filter in log4j2. I see there is on in log4net and it appears there was one written by someone for log4j 1. Just wondering if there is something 'out of the box' in log4j2 that will accomplish the same? I was wondering whether this could be accomplished with the

Re: redefining existing levels?

2015-08-25 Thread Gary Gregory
Nicholas, Yes, please see https://logging.apache.org/log4j/2.x/manual/customloglevels.html If the documentation can be improved, please let us know how. Gary On Tue, Aug 25, 2015 at 12:42 PM, Nicholas Duane nic...@msn.com wrote: Can existing log4j2 levels be redefined? I'm able to do this

redefining existing levels?

2015-08-25 Thread Nicholas Duane
Can existing log4j2 levels be redefined? I'm able to do this in log4net. I have yet to see any documentation telling me that I can do it, however, there was none telling me I could do it for .NET either. I just happen to stumble upon a post which eluded to it. Here is what I've done in a

Re: range filter?

2015-08-25 Thread Gary Gregory
On Tue, Aug 25, 2015 at 4:52 PM, Nicholas Duane nic...@msn.com wrote: Basically I need the same functionality of the LevelRangeFilter in log4net, but of course in log4j2. Patches welcome is something I often say ;-) Gary Thanks, Nick From: nic...@msn.com To:

Re: range filter?

2015-08-25 Thread Gary Gregory
Hm... maybe we need a org.apache.logging.log4j.Level.isInRange(Level, Level) method to help implement this filter... Gary On Tue, Aug 25, 2015 at 5:02 PM, Gary Gregory garydgreg...@gmail.com wrote: On Tue, Aug 25, 2015 at 4:52 PM, Nicholas Duane nic...@msn.com wrote: Basically I need the

Re: range filter?

2015-08-25 Thread Remko Popma
You misread the comment. The commentor basically told me the answer works with a minor change, and that he would mark the question as done if I would edit my answer (which I did). So the answer works and seems to apply to your use case, no? The question is if it also works with custom

Re: range filter?

2015-08-25 Thread Ralph Goers
From the manual - This filter returns the onMatch result if the level in the LogEvent is the same or more specific than the configured level and the onMismatch value otherwise.” So if you have Filters ThresholdFilter level=“DEBUG” onMatch=“NEUTRAL” onMisMatch=“DENY” ThresholdFilter

Re: range filter?

2015-08-25 Thread Ralph Goers
I should also point out that if you look at the documentation you will see that the default value for onMisMatch is “Deny”. So your first filter tests the log level and no matter what the level is it will discard the event. Ralph On Aug 25, 2015, at 2:04 PM, Nicholas Duane nic...@msn.com

Re: redefining existing levels?

2015-08-25 Thread Gary Gregory
Ah, well, let's start with the documented stuff we know should work ;-) Gary On Tue, Aug 25, 2015 at 3:19 PM, Nicholas Duane nic...@msn.com wrote: Thanks. I assumed my 'BUSINESS' level is working using the CustomLevel, though I haven't tried it yet as I was trying to validate redefining

Re: range filter?

2015-08-25 Thread Remko Popma
Can you try something similar to this http://stackoverflow.com/questions/24695133/log4j2-filter-particular-level-in-apender/24697002#24697002 and see if that works with custom levels as well? On Wed, Aug 26, 2015 at 6:04 AM, Nicholas Duane nic...@msn.com wrote: I've tried a couple different

RE: redefining existing levels?

2015-08-25 Thread Nicholas Duane
I will get to that. However, I assume that works as that's documented pretty well. So I'm looking at the other things which may or may not work as I have to find out what blocking issues we're going to run into. Redefining existing levels is one. I sent the other email regarding range level

Re: redefining existing levels?

2015-08-25 Thread Gary Gregory
Well, let's all work together to get you up and running. Hopefully we'll get other devs to keep chiming in. Gary On Tue, Aug 25, 2015 at 3:58 PM, Nicholas Duane nic...@msn.com wrote: I will get to that. However, I assume that works as that's documented pretty well. So I'm looking at the

Re: redefining existing levels?

2015-08-25 Thread Remko Popma
Is redefining levels a way to work around the issue you had with the range check? I've replied to your range check question with a link to an example config. On Wed, Aug 26, 2015 at 8:02 AM, Gary Gregory garydgreg...@gmail.com wrote: Well, let's all work together to get you up and running.

RE: redefining existing levels?

2015-08-25 Thread Nicholas Duane
No. Redefining existing levels is to help ensure we have 24x7 logging always on. So even if someone sets the level to OFF we still get INFO and above. Basically we'll have levels higher (or lower based on what platform we're talking about) than INFO OFF by default and only turn them on when

RE: range filter?

2015-08-25 Thread Nicholas Duane
Thanks. I checked out the link. It seems they were trying to do something similar to me. I see the last comment on that is that it doesn't work. There is another post afterwards which uses the ThresholdFilter. However the ThresholdFilter won't work as that allows, or denys, all levels

RE: range filter?

2015-08-25 Thread Nicholas Duane
Basically I need the same functionality of the LevelRangeFilter in log4net, but of course in log4j2. Thanks, Nick From: nic...@msn.com To: log4j-user@logging.apache.org Subject: RE: range filter? Date: Tue, 25 Aug 2015 19:49:48 -0400 Thanks. I checked out the link. It seems they were

Re: redefining existing levels?

2015-08-25 Thread Gary Gregory
I added a test called org.apache.logging.log4j.core.CustomLevelsOverrideTest in Git master. It shows that overriding a standard level's int value does not work. Gary On Tue, Aug 25, 2015 at 4:37 PM, Nicholas Duane nic...@msn.com wrote: No. Redefining existing levels is to help ensure we have

RE: range filter?

2015-08-25 Thread Nicholas Duane
I've tried a couple different combinations and so far no luck. Here's the current configuration I tested with which doesn't work: File ... PatternLayout ... /PatternLayout Filters ThresholdFilter level=INFO onMatch=DENY/ ThresholdFilter level=DEBUG onMatch=ACCEPT/

RE: redefining existing levels?

2015-08-25 Thread Nicholas Duane
I guess I should have mentioned, though it's probably obvious, that I'm only interested in a configuration based solution. I'm not looking for a code solution. Thanks, Nick From: nic...@msn.com To: log4j-user@logging.apache.org Subject: RE: redefining existing levels? Date: Tue, 25 Aug 2015

Re: redefining existing levels?

2015-08-25 Thread Gary Gregory
Nick, Your BUSINESS level should be configurable per https://logging.apache.org/log4j/2.x/manual/customloglevels.html#DefiningLevelsInConfiguration I can't look into the rest ATM. Gary On Tue, Aug 25, 2015 at 2:16 PM, Nicholas Duane nic...@msn.com wrote: I guess I should have mentioned,

RE: range filter?

2015-08-25 Thread Nicholas Duane
By the way, let me say that I'm surprisingly delighted by the quickness of responses and level of interest in solving these issues. THANK YOU. I guess after posting a few messages on the log4net mailing list and getting no responses I wasn't too hopeful about getting responses to my log4j

RE: range filter?

2015-08-25 Thread Nicholas Duane
Maybe. However, I'm having a hard time following what the configuration is saying and thus have no idea what I would need to put in the configuration. Here is a snippet from that post: !-- Now deny warn, error and fatal messages -- ThresholdFilter level=warn