logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (LOG4J2-1136) Add support for JSR 223 scripts in filters and the PatternSelector.
Date Mon, 28 Sep 2015 22:27:04 GMT

    [ https://issues.apache.org/jira/browse/LOG4J2-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14934178#comment-14934178
] 

Gary Gregory edited comment on LOG4J2-1136 at 9/28/15 10:26 PM:
----------------------------------------------------------------

I've done JavaScript in configuration files in other projects, and the first thing I did after
I got the POC working is add file references to load scripts instead of embedding the script
in the configuration. This let's you use a script language-specific editor instead of an XML
editor (or JSON, or YAML). This also avoids using CDATA.

For us, this could look like this:

{code:xml}
          <ScriptFile name="JavascriptFilter1" language="JavaScript" path="c:\foo\bar.js"
charset="UTF-8"/>
          <ScriptFile name="JavascriptFilter2" language="JavaScript" path="file:///C:/foo/bar.js"
charset="UTF-8"/>
{code}

You can also avoid using the language attribute and rely on the file extension.

Then I'd have an {{AbstractScript}} superclass for {{Script}} and {{ScriptFile}}.




was (Author: garydgregory):
I've done JavaScript in configuration files in other projects, and the first thing I did after
I got the POC working is add file references to load scripts instead of embedding the script
in the configuration. This let's you use a script language-specific editor instead of an XML
editor (or JSON, or YAML). This also avoids using CDATA.

For us, this could look like this:

{code:xml}
          <ScriptFile name="JavascriptFilter1" language="JavaScript" path="c:\foo\bar.js"
charset="UTF-8"/>
          <ScriptFile name="JavascriptFilter2" language="JavaScript" path="file:///C:/foo/bar.js"
charset="UTF-8"/>
{code}

You can also avoid using the language attribute and rely on the file extension.

Then I'd have an {{AbstractScript}} superclass for {{Script}} and {{ScriptText}}.



> Add support for JSR 223 scripts in filters and the PatternSelector.
> -------------------------------------------------------------------
>
>                 Key: LOG4J2-1136
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1136
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: Filters, Layouts
>    Affects Versions: 2.4
>            Reporter: Ralph Goers
>            Assignee: Ralph Goers
>             Fix For: 2.4.1
>
>
> Sometimes more flexibility is required in filtering and in selecting a pattern for the
PatternLayout. This enhancement provides support for JSR 223 scripts.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message