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-scripting-languages <http://stackoverflow.com/questions/11838369/where-can-i-find-a-list-of-available-jsr-223-scripting-languages>.
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 names each of them supports. Ralph > On Aug 16, 2016, at 9:37 AM, Matt Sicker <[email protected]> wrote: > > 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. > > And that last thing is probably a typo. > > On 16 August 2016 at 11:12, Greg Thomas <[email protected]> wrote: > >> 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 <delete> action will let me programmatically control which files >> are deleted (e.g. files older than some value set at runtime), but only >> during the rollover - so it may be some time before that happens (if at >> all, if the process is restarted frequently enough that the max size is >> never reached). >> >> The background to this is that we have a WAR file that is deployed to a >> number of different sites. The number of files we want to keep on each site >> can differ so rather than edit the XML file on each site each time we >> deploy a new version, there's a site specific configuration (with a >> pre-configured default) that is programatically applied. Perhaps there's a >> better way to do that. >> >> Greg >> >> PS. I can't see any documentation on supported values for the "language" >> attribute; is it just JavaScript and Groovy as per the docs, or are there >> others? >> PPS. Why is JavaScript capitalised, but not groovy? >> >> On 16 August 2016 at 16:45, Ralph Goers <[email protected]> >> wrote: >> >>> Have you looked at http://logging.apache.org/log4j/2.x/manual/appenders. >>> html#Log_Archive_Retention_Policy:_Delete_on_Rollover < >>> 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 <[email protected]> >>> wrote: >>>> >>>> Is it possible to programatically trigger a purge? >>>> >>>> I've got an XML configured appender along the lines of ... >>>> >>>> <Appenders> >>>> <RollingFile name="rfappender" fileName="../logs/output.log" >>>> filePattern="../logs/output.%i.log.zip"> >>>> <PatternLayout> >>>> <pattern>%d %-5p [%c{1}] %X - %m%n</pattern> >>>> </PatternLayout> >>>> <Policies> >>>> <OnStartupTriggeringPolicy /> >>>> <SizeBasedTriggeringPolicy size="100 MB"/> >>>> </Policies> >>>> </RollingFile> >>>> </Appenders> >>>> >>>> >>>> i.e. create new log file on startup, and when the current one reaches >>>> 100MB. There is no "max" number of files to keep >>>> >>>> I've also got, in code, something that adds a DefaultRolloverStrategy >>> with >>>> the maximum number of files to keep. However, because we already >> created >>> a >>>> new file (appender.log.nn.zip) on startup, we've probably already >>> exceeded >>>> that number, so I'd like to purge it immediately. >>>> >>>> I can't see a way to do that - any ideas? >>>> >>>> Thanks, >>>> >>>> Greg >>> >>> >> > > > > -- > Matt Sicker <[email protected]>
