Script configuration (was Re: Triggering a purge programatically)

2016-08-16 Thread Greg Thomas
> As http://logging.apache.org/log4j/2.x/manual/configuration.html#Scripts < http://logging.apache.org/log4j/2.x/manual/configuration.html#Scripts> > states, if you set status=“DEBUG” in your configuration it will print the list of > scripting engines you have installed and will print the valid nam

Re: Triggering a purge programatically

2016-08-16 Thread Greg Thomas
> You could take advantage of all the placeholder variable substitution > features for environment-specific config values. OK, so I could do something like ... But, given that log4j is initialised before I've managed to to call System.setProperty("log-files-to-keep", "42"); I don't think it wil

Re: Triggering a purge programatically

2016-08-16 Thread Ralph Goers
As Matt said, the Log4j uses the Java scripting engine and so supports any scripting language that implements (or has a wrapper that implements) JSR 223. You can find a list in this stack overflow link - http://stackoverflow.com/questions/11838369/where-can-i-find-a-list-of-available-jsr-223-sc

Re: Triggering a purge programatically

2016-08-16 Thread Matt Sicker
You could take advantage of all the placeholder variable substitution features for environment-specific config values. The language is whatever is supported by javax.script.ScriptEngineFactory. JavaScript comes out of the box, and Groovy is another common one, so it's mentioned as an alternative.

Re: Triggering a purge programatically

2016-08-16 Thread Greg Thomas
I had seen that, yes; I'm not sure it will help. What I really want to do is trigger (programmatically) a purge of old files (because I've added a DefaultRolloverStrategy with the max files set), AFAICT the action will let me programmatically control which files are deleted (e.g. files older tha

Re: Triggering a purge programatically

2016-08-16 Thread Ralph Goers
Have you looked at http://logging.apache.org/log4j/2.x/manual/appenders.html#Log_Archive_Retention_Policy:_Delete_on_Rollover ? Ralph > On Aug 16, 2016, at 6:53 AM, Greg Thomas wrote:

Triggering a purge programatically

2016-08-16 Thread Greg Thomas
Is it possible to programatically trigger a purge? I've got an XML configured appender along the lines of ... %d %-5p [%c{1}] %X - %m%n i.e. create new log file on startup, and when the current one reaches 100