You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2015/09/29 00:14:05 UTC

[jira] [Comment Edited] (LOG4J2-1136) Add support for JSR 223 scripts in filters and the PatternSelector.

    [ 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:14 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}
          <Script name="JavascriptFilter1" language="JavaScript" path="c:\foo\bar.js" charset="UTF-8"/>
          <Script 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.


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}
          <Script name="JavascriptFilter1" language="JavaScript" path="c:\foo\bar.js" charset="UTF-8"/>
          <Script name="JavascriptFilter2" language="JavaScript" path="file:///C:/foo/bar.js" charset="UTF-8"/>
{code}

> 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