"Fossies" - the Fresh Open Source Software Archive

Member "apache-log4j-2.12.4-src/log4j-core/src/test/resources/log4j-script-filters.xml" (20 Dec 2021, 2163 Bytes) of package /linux/misc/apache-log4j-2.12.4-src.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) XML source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 <?xml version="1.0" encoding="UTF-8"?>
    2 <!--
    3   ~ Licensed to the Apache Software Foundation (ASF) under one or more
    4   ~ contributor license agreements. See the NOTICE file distributed with
    5   ~ this work for additional information regarding copyright ownership.
    6   ~ The ASF licenses this file to You under the Apache License, Version 2.0
    7   ~ (the "License"); you may not use this file except in compliance with
    8   ~ the License. You may obtain a copy of the License at
    9   ~
   10   ~      http://www.apache.org/licenses/LICENSE-2.0
   11   ~
   12   ~ Unless required by applicable law or agreed to in writing, software
   13   ~ distributed under the License is distributed on an "AS IS" BASIS,
   14   ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   15   ~ See the License for the specific language governing permissions and
   16   ~ limitations under the License.
   17   -->
   18 <Configuration status="ERROR">
   19   <Appenders>
   20     <List name="List">
   21       <PatternLayout pattern="[%-5level] %c{1.} %msg%n"/>
   22     </List>
   23   </Appenders>
   24   <Loggers>
   25     <Logger name="TestJavaScriptFilter" level="trace" additivity="false">
   26       <AppenderRef ref="List">
   27         <ScriptFilter onMatch="ACCEPT" onMisMatch="DENY">
   28           <Script name="JavascriptFilter" language="JavaScript"><![CDATA[
   29             var result = false;
   30             if (logEvent.getMarker() != null && logEvent.getMarker().isInstanceOf("FLOW")) {
   31                 result = true;
   32             } else if (logEvent.getContextMap().containsKey("UserId")) {
   33                 result = true;
   34             }
   35             result;
   36             ]]>
   37           </Script>
   38         </ScriptFilter>
   39       </AppenderRef>
   40     </Logger>
   41     <Logger name="TestGroovyFilter" level="trace" additivity="false">
   42       <AppenderRef ref="List">
   43         <ScriptFilter onMatch="ACCEPT" onMisMatch="DENY">
   44           <Script name="GroovyFilter" language="groovy"><![CDATA[
   45             logEvent.marker?.isInstanceOf('FLOW') || logEvent.contextMap.containsKey('UserId')
   46             ]]>
   47           </Script>
   48         </ScriptFilter>
   49       </AppenderRef>
   50     </Logger>
   51     <Root level="trace">
   52       <AppenderRef ref="List" />
   53     </Root>
   54   </Loggers>
   55 </Configuration>