Re: OS-based dynamic configuration file

2016-09-19 Thread Gary Gregory
Branch LOG4J2-1597 merged in Git master; tracked with https://issues.apache.org/jira/browse/LOG4J2-1597. I'll delete the LOG4J2-1597 branch soon. Gary On Mon, Sep 19, 2016 at 4:55 PM, Gary Gregory wrote: > I am OK with ScriptAppenderSelector so I'll change it to that. > > Gary > > On Mon, Sep 1

Re: OS-based dynamic configuration file

2016-09-19 Thread Gary Gregory
I am OK with ScriptAppenderSelector so I'll change it to that. Gary On Mon, Sep 19, 2016 at 3:23 PM, Ralph Goers wrote: > The 3 obvious choices: ScriptSelectorAppender, ScriptAppenderSelector, or > AppenderScriptSelector. I actually prefer the second as it is an > AppenderSelector that uses a S

Re: OS-based dynamic configuration file

2016-09-19 Thread Ralph Goers
The 3 obvious choices: ScriptSelectorAppender, ScriptAppenderSelector, or AppenderScriptSelector. I actually prefer the second as it is an AppenderSelector that uses a Script (or rather, a Selector of an Appender that uses a Script). The first isn’t too bad as it is an Appender that is a Script

Re: OS-based dynamic configuration file

2016-09-19 Thread Gary Gregory
ScriptSelectorAppender? On Sep 19, 2016 2:29 PM, "Ralph Goers" wrote: > Actually, I do have one minor issue. It will cause confusion calling it > ScriptSelector. I am imagining the next step will be to create a > LayoutSelector that uses Scripts. I can also imagine a Selector for > AppenderRefs

Re: OS-based dynamic configuration file

2016-09-19 Thread Ralph Goers
Actually, I do have one minor issue. It will cause confusion calling it ScriptSelector. I am imagining the next step will be to create a LayoutSelector that uses Scripts. I can also imagine a Selector for AppenderRefs that uses Scripts. So calling it ScriptSelector is a bit ambiguous, unless i

Re: OS-based dynamic configuration file

2016-09-19 Thread Gary Gregory
Ok, thank you. I'll merge in a couple of hours. Gary On Sep 19, 2016 2:22 PM, "Ralph Goers" wrote: > I took a look and it looks OK to me. > > On Sep 19, 2016, at 12:02 AM, Gary Gregory wrote: > > Great, thanks Ralph. > > Gary > > On Sun, Sep 18, 2016 at 11:14 PM, Ralph Goers > wrote: > >> Yup

Re: OS-based dynamic configuration file

2016-09-19 Thread Ralph Goers
I took a look and it looks OK to me. > On Sep 19, 2016, at 12:02 AM, Gary Gregory wrote: > > Great, thanks Ralph. > > Gary > > On Sun, Sep 18, 2016 at 11:14 PM, Ralph Goers > wrote: > Yup to both. I’ll look at it tomorrow. > > Ralph > >> On Sep 18, 2016, a

Re: OS-based dynamic configuration file

2016-09-19 Thread Gary Gregory
Great, thanks Ralph. Gary On Sun, Sep 18, 2016 at 11:14 PM, Ralph Goers wrote: > Yup to both. I’ll look at it tomorrow. > > Ralph > > On Sep 18, 2016, at 10:31 PM, Gary Gregory wrote: > > Nevermind, I can just overwrite the name in the Node's attribute map... > that works. I'd like a code revi

Re: OS-based dynamic configuration file

2016-09-18 Thread Ralph Goers
Yup to both. I’ll look at it tomorrow. Ralph > On Sep 18, 2016, at 10:31 PM, Gary Gregory wrote: > > Nevermind, I can just overwrite the name in the Node's attribute map... that > works. I'd like a code review before or after merging to master. > > Gary > > On Sun, Sep 18, 2016 at 9:43 PM,

Re: OS-based dynamic configuration file

2016-09-18 Thread Gary Gregory
Nevermind, I can just overwrite the name in the Node's attribute map... that works. I'd like a code review before or after merging to master. Gary On Sun, Sep 18, 2016 at 9:43 PM, Gary Gregory wrote: > Hm, but how? org.apache.logging.log4j.core.appender.AbstractAppender.name > is final and ther

Re: OS-based dynamic configuration file

2016-09-18 Thread Gary Gregory
Hm, but how? org.apache.logging.log4j.core.appender.AbstractAppender.name is final and there is no Appender.setName(String). Surely, we should not use reflection... Gary On Sun, Sep 18, 2016 at 9:34 PM, Ralph Goers wrote: > I haven’t looked at your code but when you create the “real” appender y

Re: OS-based dynamic configuration file

2016-09-18 Thread Ralph Goers
I haven’t looked at your code but when you create the “real” appender you need to change its name to match the name of the selector so that AppenderRefs work. Ralph > On Sep 18, 2016, at 9:24 PM, Gary Gregory wrote: > > I've implemented a first cut in the branch LOG4J2-1597 but I think I need

Re: OS-based dynamic configuration file

2016-09-18 Thread Gary Gregory
I've implemented a first cut in the branch LOG4J2-1597 but I think I need some help to connect the final dot (or two). When I run the new unit test org.apache.logging.log4j.core.appender.ScriptSelectorAppenderTest, the status logger shows: 2016-09-18 21:19:09,393 main ERROR Unable to locate appen

Re: OS-based dynamic configuration file

2016-09-17 Thread Gary Gregory
Ralph, Thank you again for the explanation. I'll take a closer look... Gary On Sat, Sep 17, 2016 at 9:48 AM, Ralph Goers wrote: > See inline > > On Sep 16, 2016, at 10:31 PM, Gary Gregory wrote: > > On Fri, Sep 16, 2016 at 8:38 PM, Ralph Goers > wrote: > >> Gary, >> >> I have no problem with

Re: OS-based dynamic configuration file

2016-09-17 Thread Ralph Goers
See inline > On Sep 16, 2016, at 10:31 PM, Gary Gregory wrote: > > On Fri, Sep 16, 2016 at 8:38 PM, Ralph Goers > wrote: > Gary, > > I have no problem with components that can be dumbed down to do simple > things. I do have a problem with components that onl

Re: OS-based dynamic configuration file

2016-09-17 Thread Ralph Goers
That is essentially the same as Gary’s use case. Ralph > On Sep 17, 2016, at 9:06 AM, Matt Sicker wrote: > > I can see another use case here, though I'm not sure if it's covered already > by RoutingAppender. In a development environment, you'd have log messages > going to a log file, but in p

Re: OS-based dynamic configuration file

2016-09-17 Thread Matt Sicker
I can see another use case here, though I'm not sure if it's covered already by RoutingAppender. In a development environment, you'd have log messages going to a log file, but in production, you'd have log messages being going to a KafkaAppender or FlumeAppender. It'd be useful in microservice deve

Re: OS-based dynamic configuration file

2016-09-16 Thread Gary Gregory
On Fri, Sep 16, 2016 at 8:38 PM, Ralph Goers wrote: > Gary, > > I have no problem with components that can be dumbed down to do simple > things. I do have a problem with components that only do simple things > because people will constantly asked to have them be enhanced. > > As for what you are

Re: OS-based dynamic configuration file

2016-09-16 Thread Ralph Goers
Gary, I have no problem with components that can be dumbed down to do simple things. I do have a problem with components that only do simple things because people will constantly asked to have them be enhanced. As for what you are proposing here, can I just say “No”? Having the Appenders elem

Re: OS-based dynamic configuration file

2016-09-16 Thread Gary Gregory
Now I've dived into this part of the code and consider what this configuration means for my use case, I see that it works and that the new feature has merit on its own but... It feels to me like my specific use case is an edge case of this new routing appender feature: I will only ever have one rou

Re: OS-based dynamic configuration file

2016-09-13 Thread Gary Gregory
I committed a first cut, see comments in https://issues.apache.org/jira/browse/LOG4J2-1578 Gary On Mon, Sep 12, 2016 at 11:40 PM, Ralph Goers wrote: > Yes, it returns the key. Remember, a Route can dynamically create an > Appender so it isn’t required to be a reference. At the same time we can

Re: OS-based dynamic configuration file

2016-09-12 Thread Ralph Goers
Yes, it returns the key. Remember, a Route can dynamically create an Appender so it isn’t required to be a reference. At the same time we can (and probably should) pass variables and/or a Map to the script that it can update in any way it wants for later usage by the Routing script. As is shown

Re: OS-based dynamic configuration file

2016-09-12 Thread Gary Gregory
Wait a sec, the DefaultRouteScript should return the Route key, not the Route ref. Right? Gary On Mon, Sep 12, 2016 at 9:53 PM, Gary Gregory wrote: > "First, the init script changes the default route based on the OS." > > Maybe the tag should be called "DefaultRouteScript" since it's job is to

Re: OS-based dynamic configuration file

2016-09-12 Thread Gary Gregory
"First, the init script changes the default route based on the OS." Maybe the tag should be called "DefaultRouteScript" since it's job is to return the default route name? Gary On Mon, Sep 12, 2016 at 8:05 PM, Ralph Goers wrote: > After reviewing what I wrote below and looking at the Routing A

Re: OS-based dynamic configuration file

2016-09-12 Thread Gary Gregory
Tracking here: https://issues.apache.org/jira/browse/LOG4J2-1578 Gary On Mon, Sep 12, 2016 at 8:37 PM, Gary Gregory wrote: > Thanks Ralph. I'll start with > > LOG4J2-1577 Add a Builder to the RoutingAppender and deprecate factory > method > > and create another Jira after that. > > Gary > > On

Re: OS-based dynamic configuration file

2016-09-12 Thread Gary Gregory
Thanks Ralph. I'll start with LOG4J2-1577 Add a Builder to the RoutingAppender and deprecate factory method and create another Jira after that. Gary On Mon, Sep 12, 2016 at 8:05 PM, Ralph Goers wrote: > After reviewing what I wrote below and looking at the Routing Appender I > think the best

Re: OS-based dynamic configuration file

2016-09-12 Thread Ralph Goers
Replace the “?” characters with double quotes. Ralph > On Sep 12, 2016, at 8:05 PM, Ralph Goers wrote: > > After reviewing what I wrote below and looking at the Routing Appender I > think the best thing to do is just to add script support to it. It already > has support for a default Route.

Re: OS-based dynamic configuration file

2016-09-12 Thread Ralph Goers
After reviewing what I wrote below and looking at the Routing Appender I think the best thing to do is just to add script support to it. It already has support for a default Route. The init script, if present, could override which Route to use as I described below. Then we could add a script at

Re: OS-based dynamic configuration file

2016-09-12 Thread Ralph Goers
I’ll try to describe it better but I’m not sure how good a job I’ll do if the dots aren’t clicking yet. Also, even though I might say to do it one way if I was coding I could very well change my mind as I implement it. That said: Create an Appender plugin named ScriptSelector or ScriptAppenderSel

Re: OS-based dynamic configuration file

2016-09-12 Thread Gary Gregory
On Sun, Sep 11, 2016 at 12:47 PM, Ralph Goers wrote: > Yes. The Appenders tag inside the ScriptSelector are the Appenders that > are to be created. But now that I think about it, we can’t use “Appenders” > for this. If you look at the RoutingAppender you will notice that Appenders > there are dec

Re: OS-based dynamic configuration file

2016-09-11 Thread Ralph Goers
Yes. The Appenders tag inside the ScriptSelector are the Appenders that are to be created. But now that I think about it, we can’t use “Appenders” for this. If you look at the RoutingAppender you will notice that Appenders there are declared under a Route element. The Route plugin is defined wit

Re: OS-based dynamic configuration file

2016-09-11 Thread Gary Gregory
Or maybe call is "StartScript"? since we have the notion of life-cycle and appenders have start() and stop() methods. I'm not sure we'd need a StopScript but it makes it look nicer IMO. The Init/StartScript would run when the ScriptSelectorAppender is started right? Gary Gary On Sun, Sep 11, 201

Re: OS-based dynamic configuration file

2016-09-11 Thread Gary Gregory
Are the tags really meant to be nested? Gary On Sat, Sep 10, 2016 at 11:48 AM, Ralph Goers wrote: > Oops. I forgot the closing CDATA tag in the script. > > Ralph > > On Sep 10, 2016, at 11:43 AM, Ralph Goers > wrote: > > Interesting. OS/390. I worked on MVS, OS/370, z/OS, etc many moons ago

Re: OS-based dynamic configuration file

2016-09-11 Thread Ralph Goers
The configuration would look just like what I have shown except it would probably be “InitScript” instead of “Script”. It could make sense to allow both as I could envision the InitScript setting things up for the script that runs every time, but we would need a way to pass data between them. Th

Re: OS-based dynamic configuration file

2016-09-11 Thread Gary Gregory
On Sat, Sep 10, 2016 at 11:43 AM, Ralph Goers wrote: > Interesting. OS/390. I worked on MVS, OS/370, z/OS, etc many moons ago > but haven’t worked on a mainframe since 2001. > > This sort of sounds like you want an Appender Selector, which would be an > Appender that uses a Selector to figure ou

Re: OS-based dynamic configuration file

2016-09-11 Thread Remko Popma
I see. For what it's worth, I like the embedded script idea. It seems like it could be very powerful. On Mon, Sep 12, 2016 at 12:11 AM, Gary Gregory wrote: > On Sep 10, 2016 11:33 PM, "Ralph Goers" > wrote: > > > > But Gary said he didn’t want the OS390 appender created unless he is > running

Re: OS-based dynamic configuration file

2016-09-11 Thread Gary Gregory
On Sep 10, 2016 11:33 PM, "Ralph Goers" wrote: > > But Gary said he didn’t want the OS390 appender created unless he is running on OS390. Right, IRL, I am going to use an Appender that does some JNI calls that will only work on OS/390. Gary > > But your example makes me think we also need an Ap

Re: OS-based dynamic configuration file

2016-09-10 Thread Ralph Goers
But Gary said he didn’t want the OS390 appender created unless he is running on OS390. But your example makes me think we also need an AppenderRef Selector. Ralph > On Sep 10, 2016, at 5:28 PM, Remko Popma wrote: > > What you can also do (without Log4j enhancements) is create a plugin appende

Re: OS-based dynamic configuration file

2016-09-10 Thread Remko Popma
What you can also do (without Log4j enhancements) is create a plugin appender that takes two Appender-Refs and delegates to the correct one for your application. In configuration this could look like this: Remko Sent from my iPhone > On 2016/09/11, at 3:48, Ralph Goers wr

Re: OS-based dynamic configuration file

2016-09-10 Thread Ralph Goers
Oops. I forgot the closing CDATA tag in the script. Ralph > On Sep 10, 2016, at 11:43 AM, Ralph Goers wrote: > > Interesting. OS/390. I worked on MVS, OS/370, z/OS, etc many moons ago but > haven’t worked on a mainframe since 2001. > > This sort of sounds like you want an Appender Selector,

Re: OS-based dynamic configuration file

2016-09-10 Thread Ralph Goers
Interesting. OS/390. I worked on MVS, OS/370, z/OS, etc many moons ago but haven’t worked on a mainframe since 2001. This sort of sounds like you want an Appender Selector, which would be an Appender that uses a Selector to figure out which Appender to delegate to. This is a bit like the Patte

Re: OS-based dynamic configuration file

2016-09-10 Thread Matt Sicker
Could you combine a Routing Appender with a Script Filter? Might work for your needs here. On 10 September 2016 at 13:04, Gary Gregory wrote: > > > System.getProperty("os.name").contains("OS/390") > > > > > > > > > > ? > > > On Sat, Se

Re: OS-based dynamic configuration file

2016-09-10 Thread Gary Gregory
System.getProperty("os.name").contains("OS/390") ? On Sat, Sep 10, 2016 at 10:40 AM, Gary Gregory wrote: > OK, I found https://logging.apache.org/log4j/2.x/manual/ > configuration.html#Scripts and I think I could use either: > > - Us

Re: OS-based dynamic configuration file

2016-09-10 Thread Gary Gregory
OK, I found https://logging.apache.org/log4j/2.x/manual/configuration.html#Scripts and I think I could use either: - Use composite configurations: One file for OS/390, one for all other OSs; or - Do it all in one configuration file (that seems simpler) It seems like there are some pieces missing

OS-based dynamic configuration file

2016-09-10 Thread Gary Gregory
Hi, I can't seem to find on our site the scripting support that was recently added (or is that only in master?). What I need to do is only add a specific appender when running on a specific OS (USS on OS/390 if you must know). Then only add a different appender when not running on that OS. I'd r