You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2017/11/27 17:58:18 UTC
[3/4] logging-log4j2 git commit: Log4j samples folder names should
match artifact IDs.
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/flume-embedded/src/main/resources/log4j-embedded.xml
----------------------------------------------------------------------
diff --git a/log4j-samples/flume-embedded/src/main/resources/log4j-embedded.xml b/log4j-samples/flume-embedded/src/main/resources/log4j-embedded.xml
deleted file mode 100755
index 056e1f4..0000000
--- a/log4j-samples/flume-embedded/src/main/resources/log4j-embedded.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<Configuration status="debug" name="Flume" verbose="false" monitorInterval="30">
- <MarkerFilter marker="EVENT" onMatch="ACCEPT" onMismatch="NEUTRAL" />
- <Appenders>
-
- <Flume name="flume" ignoreExceptions="false" mdcPrefix="ReqCtx_" compress="false" embedded="true" dataDir="/tmp">
- <Agent host="localhost" port="8800" />
- <RFC5424Layout enterpriseNumber="12293" includeMDC="true" mdcId="RequestContext" appName="GL" />
- </Flume>
- <Console name="console">
- <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36}:%L %M - %msg%n" />
- </Console>
- <RollingFile name="RollingFile" fileName="${sys:log.dir}/app.log"
- filePattern="${sys:log.dir}/app-%d{MM-dd-yyyy}-%i.log.gz">
- <PatternLayout>
- <pattern>%d %p %C{1.} [%t] %m%n</pattern>
- </PatternLayout>
- <Policies>
- <TimeBasedTriggeringPolicy />
- <SizeBasedTriggeringPolicy size="250 MB" />
- </Policies>
- </RollingFile>
- </Appenders>
- <Loggers>
- <Logger name="EventLogger" level="WARN" additivity="false">
- <AppenderRef ref="flume" />
- </Logger>
- <Root level="debug">
- <AppenderRef ref="RollingFile" />
- </Root>
- </Loggers>
-</Configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/flume-embedded/src/main/webapp/WEB-INF/applicationContext.xml
----------------------------------------------------------------------
diff --git a/log4j-samples/flume-embedded/src/main/webapp/WEB-INF/applicationContext.xml b/log4j-samples/flume-embedded/src/main/webapp/WEB-INF/applicationContext.xml
deleted file mode 100755
index f4b160d..0000000
--- a/log4j-samples/flume-embedded/src/main/webapp/WEB-INF/applicationContext.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:context="http://www.springframework.org/schema/context" xmlns:oxm="http://www.springframework.org/schema/oxm"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/aop
- http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/oxm
- http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
- <context:component-scan base-package="org.apache.logging.log4j.samples">
- <context:exclude-filter type="annotation"
- expression="org.springframework.ws.server.endpoint.annotation.Endpoint" />
- <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
- </context:component-scan>
-
-</beans>
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/flume-embedded/src/main/webapp/WEB-INF/rest-servlet.xml
----------------------------------------------------------------------
diff --git a/log4j-samples/flume-embedded/src/main/webapp/WEB-INF/rest-servlet.xml b/log4j-samples/flume-embedded/src/main/webapp/WEB-INF/rest-servlet.xml
deleted file mode 100755
index 73f4fb6..0000000
--- a/log4j-samples/flume-embedded/src/main/webapp/WEB-INF/rest-servlet.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
- xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:sws="http://www.springframework.org/schema/web-services"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/aop
- http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
- http://www.springframework.org/schema/oxm
- http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
- <context:component-scan base-package="org.apache.logging.log4j.samples.*" />
-
-</beans>
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/flume-embedded/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/log4j-samples/flume-embedded/src/main/webapp/WEB-INF/web.xml b/log4j-samples/flume-embedded/src/main/webapp/WEB-INF/web.xml
deleted file mode 100755
index 7a64562..0000000
--- a/log4j-samples/flume-embedded/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
- http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-
- <display-name>Global Logging Services</display-name>
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
-
- <servlet>
- <servlet-name>rest</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <load-on-startup>6</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>rest</servlet-name>
- <url-pattern>*.do</url-pattern>
- </servlet-mapping>
-
- <welcome-file-list>
- <welcome-file>index.jsp</welcome-file>
- </welcome-file-list>
-
- <session-config>
- <session-timeout>5</session-timeout>
- </session-config>
-
- <listener>
- <listener-class>org.apache.logging.log4j.web.Log4jServletContextListener</listener-class>
- </listener>
-
- <context-param>
- <param-name>log4jConfiguration</param-name>
- <param-value>file://${project.build.directory}/classes/log4j-embedded.xml</param-value>
- </context-param>
-
- <context-param>
- <param-name>log4jContextName</param-name>
- <param-value>GLS</param-value>
- </context-param>
-</web-app>
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/flume-embedded/src/main/webapp/start.jsp
----------------------------------------------------------------------
diff --git a/log4j-samples/flume-embedded/src/main/webapp/start.jsp b/log4j-samples/flume-embedded/src/main/webapp/start.jsp
deleted file mode 100644
index 8db53a2..0000000
--- a/log4j-samples/flume-embedded/src/main/webapp/start.jsp
+++ /dev/null
@@ -1,30 +0,0 @@
-<%--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
---%>
-<html>
-<body>
-
-<h2>Rest Client</h2>
-<p>
- Started
-</p>
-<form action="stop.do" method="GET">
- <input type="submit" value="Stop" />
-</form>
-</body>
-</html>
-
-
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/flume-embedded/src/main/webapp/stop.jsp
----------------------------------------------------------------------
diff --git a/log4j-samples/flume-embedded/src/main/webapp/stop.jsp b/log4j-samples/flume-embedded/src/main/webapp/stop.jsp
deleted file mode 100644
index fab3be6..0000000
--- a/log4j-samples/flume-embedded/src/main/webapp/stop.jsp
+++ /dev/null
@@ -1,28 +0,0 @@
-<%--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
---%>
-<html>
-<body>
-
-<h2>Rest Client</h2>
-<p>
- Stopped
-</p>
-<form action="start.do" method="GET">
- <input type="submit" value="Start" />
-</form>
-</body>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/flume-remote/.gitignore
----------------------------------------------------------------------
diff --git a/log4j-samples/flume-remote/.gitignore b/log4j-samples/flume-remote/.gitignore
deleted file mode 100644
index 9f0fc21..0000000
--- a/log4j-samples/flume-remote/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-/.settings/
-/target/
-/.classpath
-/.project
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/flume-remote/README.txt
----------------------------------------------------------------------
diff --git a/log4j-samples/flume-remote/README.txt b/log4j-samples/flume-remote/README.txt
deleted file mode 100644
index 3ab80d2..0000000
--- a/log4j-samples/flume-remote/README.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-Sample to connect to a Flume Agent via Avro using the FlumeAppender.
-
-This sample uses the classes in the sample flume-common project. It will randomly pick from the events defined there
-and send them to Flume. At the same time it will intermix some random non-audit events.
-
-To run this sample:
-1. Run "mvn install" on the flume-common project.
-2. Download and install Flume.
-3. Copy the flume-conf.properties in src/main/resources/flume/conf to the conf directory of where Flume was installed.
-4. In a terminal window start flume using "bin/flume-ng agent --conf ./conf/ -f conf/flume-conf.properties -Dflume.root.logger=DEBUG,console -n agent"
-5. Verify Flume started and configured an Avro source, a memory channel and a logger sink by reviewing the startup log.
-6. In a separate terminal window run "mvn jetty:run" in this project.
-7. Verify the Flume appender connected to the Flume agent by finding "Starting FlumeAvroManager FlumeAvro[localhost:8800]"
- in the jetty log and that there are no exceptions and also by seeing something like
- "/127.0.0.1:53351 => /127.0.0.1:8800] OPEN" in the Flume log.
-8. In a separate terminal window in the project directory run "tail -f target/logs/app.log" to see the application
- generate non-audit logs.
-9. In the browser go to url "http://localhost:8080/flumeAgent/start.do". A started message should appear on the screen.
-10. After verifying logs are being written click on the Stop button in the browser page.
-
-Note that the Flume agent must be started for the FlumeAppender to successfully start. If the Flume agent is stopped
-an exception will be thrown for each event that occurs while the agent is down. When the agent restarts the
-appender will automatically reconnect.
-
-The output from the Flume agent will include the generated Flume events. Since the events are sent individually
-Avro will print the full event and Flume will print a hex dump of the first few bytes of the event.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/flume-remote/pom.xml
----------------------------------------------------------------------
diff --git a/log4j-samples/flume-remote/pom.xml b/log4j-samples/flume-remote/pom.xml
deleted file mode 100644
index 956e095..0000000
--- a/log4j-samples/flume-remote/pom.xml
+++ /dev/null
@@ -1,139 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>log4j-samples</artifactId>
- <groupId>org.apache.logging.log4j.samples</groupId>
- <version>2.10.1-SNAPSHOT</version>
- </parent>
- <artifactId>log4j-samples-flume-remote</artifactId>
- <packaging>war</packaging>
- <name>Apache Log4j Samples: Flume - Remote</name>
- <url>http://maven.apache.org</url>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.apache.logging.log4j.samples</groupId>
- <artifactId>log4j-samples-flume-common</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-flume-ng</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-webmvc</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.ws</groupId>
- <artifactId>spring-ws-core</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <resources>
- <resource>
- <directory>../../src/main/resources</directory>
- </resource>
- <resource>
- <directory>../../src/main/webapp/WEB-INF</directory>
- <includes>
- <include>web.xml</include>
- </includes>
- <filtering>true</filtering>
- <targetPath>${project.build.directory}</targetPath>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-install-plugin</artifactId>
- <version>2.5.2</version>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>2.4</version>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
- <version>6.1.26</version>
- <configuration>
- <contextPath>flumeAgent</contextPath>
- <webXml>${project.build.directory}/web.xml</webXml>
- <scanIntervalSeconds>10</scanIntervalSeconds>
- <stopKey>foo</stopKey>
- <stopPort>9999</stopPort>
- <systemProperties>
- <systemProperty>
- <name>log.dir</name>
- <value>${project.build.directory}/logs</value>
- </systemProperty>
- </systemProperties>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>2.8.2</version>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/flume-remote/src/main/resources/flume/conf/flume-conf.properties
----------------------------------------------------------------------
diff --git a/log4j-samples/flume-remote/src/main/resources/flume/conf/flume-conf.properties b/log4j-samples/flume-remote/src/main/resources/flume/conf/flume-conf.properties
deleted file mode 100644
index 9cbbfde..0000000
--- a/log4j-samples/flume-remote/src/main/resources/flume/conf/flume-conf.properties
+++ /dev/null
@@ -1,50 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-
-# The configuration file needs to define the sources,
-# the channels and the sinks.
-# Sources, channels and sinks are defined per agent,
-# in this case called 'agent'
-
-agent.sources = avroSrc
-agent.channels = memoryChannel
-agent.sinks = loggerSink
-
-# For each one of the sources, the type is defined
-# agent.sources.seqGenSrc.type = seq
-
-agent.sources.avroSrc.type = avro
-agent.sources.avroSrc.bind = localhost
-agent.sources.avroSrc.port = 8800
-
-# The channel can be defined as follows.
-agent.sources.avroSrc.channels = memoryChannel
-
-# Each sink's type must be defined
-agent.sinks.loggerSink.type = logger
-
-#Specify the channel the sink should use
-agent.sinks.loggerSink.channel = memoryChannel
-
-# Each channel's type is defined.
-agent.channels.memoryChannel.type = memory
-
-# Other config values specific to each type of channel(sink or source)
-# can be defined as well
-# In this case, it specifies the capacity of the memory channel
-agent.channels.memoryChannel.capacity = 100
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/flume-remote/src/main/resources/log4j-remote.xml
----------------------------------------------------------------------
diff --git a/log4j-samples/flume-remote/src/main/resources/log4j-remote.xml b/log4j-samples/flume-remote/src/main/resources/log4j-remote.xml
deleted file mode 100755
index 324b17d..0000000
--- a/log4j-samples/flume-remote/src/main/resources/log4j-remote.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<Configuration status="debug" name="Flume" verbose="false" monitorInterval="30">
- <MarkerFilter marker="EVENT" onMatch="ACCEPT" onMismatch="NEUTRAL" />
- <Appenders>
-
- <Flume name="flume" ignoreExceptions="false" mdcPrefix="ReqCtx_" compress="false">
- <Agent host="localhost" port="8800" />
- <RFC5424Layout enterpriseNumber="12293" includeMDC="true" mdcId="RequestContext" appName="GL" />
- </Flume>
- <Console name="console">
- <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36}:%L %M - %msg%n" />
- </Console>
- <RollingFile name="RollingFile" fileName="${sys:log.dir}/app.log"
- filePattern="${sys:log.dir}/app-%d{MM-dd-yyyy}-%i.log.gz">
- <PatternLayout>
- <pattern>%d %p %C{1.} [%t] %m%n</pattern>
- </PatternLayout>
- <Policies>
- <TimeBasedTriggeringPolicy />
- <SizeBasedTriggeringPolicy size="250 MB" />
- </Policies>
- </RollingFile>
- </Appenders>
- <Loggers>
- <Logger name="EventLogger" level="WARN" additivity="false">
- <AppenderRef ref="flume" />
- </Logger>
- <Root level="debug">
- <AppenderRef ref="RollingFile" />
- </Root>
- </Loggers>
-</Configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/flume-remote/src/main/webapp/WEB-INF/applicationContext.xml
----------------------------------------------------------------------
diff --git a/log4j-samples/flume-remote/src/main/webapp/WEB-INF/applicationContext.xml b/log4j-samples/flume-remote/src/main/webapp/WEB-INF/applicationContext.xml
deleted file mode 100755
index f4b160d..0000000
--- a/log4j-samples/flume-remote/src/main/webapp/WEB-INF/applicationContext.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:context="http://www.springframework.org/schema/context" xmlns:oxm="http://www.springframework.org/schema/oxm"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/aop
- http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/oxm
- http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
- <context:component-scan base-package="org.apache.logging.log4j.samples">
- <context:exclude-filter type="annotation"
- expression="org.springframework.ws.server.endpoint.annotation.Endpoint" />
- <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
- </context:component-scan>
-
-</beans>
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/flume-remote/src/main/webapp/WEB-INF/rest-servlet.xml
----------------------------------------------------------------------
diff --git a/log4j-samples/flume-remote/src/main/webapp/WEB-INF/rest-servlet.xml b/log4j-samples/flume-remote/src/main/webapp/WEB-INF/rest-servlet.xml
deleted file mode 100755
index 73f4fb6..0000000
--- a/log4j-samples/flume-remote/src/main/webapp/WEB-INF/rest-servlet.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
- xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:sws="http://www.springframework.org/schema/web-services"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/aop
- http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
- http://www.springframework.org/schema/oxm
- http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
- <context:component-scan base-package="org.apache.logging.log4j.samples.*" />
-
-</beans>
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/flume-remote/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/log4j-samples/flume-remote/src/main/webapp/WEB-INF/web.xml b/log4j-samples/flume-remote/src/main/webapp/WEB-INF/web.xml
deleted file mode 100755
index 0a0961d..0000000
--- a/log4j-samples/flume-remote/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
- http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
-
- <display-name>Global Logging Services</display-name>
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
-
- <servlet>
- <servlet-name>rest</servlet-name>
- <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
- <load-on-startup>6</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>rest</servlet-name>
- <url-pattern>*.do</url-pattern>
- </servlet-mapping>
-
- <welcome-file-list>
- <welcome-file>index.jsp</welcome-file>
- </welcome-file-list>
-
- <session-config>
- <session-timeout>5</session-timeout>
- </session-config>
-
- <listener>
- <listener-class>org.apache.logging.log4j.web.Log4jServletContextListener</listener-class>
- </listener>
-
- <context-param>
- <param-name>log4jConfiguration</param-name>
- <param-value>file://${project.build.directory}/classes/log4j-remote.xml</param-value>
- </context-param>
-
- <context-param>
- <param-name>log4jContextName</param-name>
- <param-value>GLS</param-value>
- </context-param>
-</web-app>
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/flume-remote/src/main/webapp/start.jsp
----------------------------------------------------------------------
diff --git a/log4j-samples/flume-remote/src/main/webapp/start.jsp b/log4j-samples/flume-remote/src/main/webapp/start.jsp
deleted file mode 100644
index 8db53a2..0000000
--- a/log4j-samples/flume-remote/src/main/webapp/start.jsp
+++ /dev/null
@@ -1,30 +0,0 @@
-<%--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
---%>
-<html>
-<body>
-
-<h2>Rest Client</h2>
-<p>
- Started
-</p>
-<form action="stop.do" method="GET">
- <input type="submit" value="Stop" />
-</form>
-</body>
-</html>
-
-
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/flume-remote/src/main/webapp/stop.jsp
----------------------------------------------------------------------
diff --git a/log4j-samples/flume-remote/src/main/webapp/stop.jsp b/log4j-samples/flume-remote/src/main/webapp/stop.jsp
deleted file mode 100644
index fab3be6..0000000
--- a/log4j-samples/flume-remote/src/main/webapp/stop.jsp
+++ /dev/null
@@ -1,28 +0,0 @@
-<%--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
---%>
-<html>
-<body>
-
-<h2>Rest Client</h2>
-<p>
- Stopped
-</p>
-<form action="start.do" method="GET">
- <input type="submit" value="Start" />
-</form>
-</body>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/log4j-samples-configuration/.gitignore
----------------------------------------------------------------------
diff --git a/log4j-samples/log4j-samples-configuration/.gitignore b/log4j-samples/log4j-samples-configuration/.gitignore
new file mode 100644
index 0000000..ddd6d6d
--- /dev/null
+++ b/log4j-samples/log4j-samples-configuration/.gitignore
@@ -0,0 +1,3 @@
+/.settings/
+/.classpath
+/.project
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/log4j-samples-configuration/pom.xml
----------------------------------------------------------------------
diff --git a/log4j-samples/log4j-samples-configuration/pom.xml b/log4j-samples/log4j-samples-configuration/pom.xml
new file mode 100644
index 0000000..b4a86b4
--- /dev/null
+++ b/log4j-samples/log4j-samples-configuration/pom.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>log4j-samples</artifactId>
+ <groupId>org.apache.logging.log4j.samples</groupId>
+ <version>2.10.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>log4j-samples-configuration</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Log4j Samples: Configuration</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.8.2</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/log4j-samples-configuration/src/main/java/org/apache/logging/log4j/configuration/CustomConfiguration.java
----------------------------------------------------------------------
diff --git a/log4j-samples/log4j-samples-configuration/src/main/java/org/apache/logging/log4j/configuration/CustomConfiguration.java b/log4j-samples/log4j-samples-configuration/src/main/java/org/apache/logging/log4j/configuration/CustomConfiguration.java
new file mode 100644
index 0000000..6e3bddb
--- /dev/null
+++ b/log4j-samples/log4j-samples-configuration/src/main/java/org/apache/logging/log4j/configuration/CustomConfiguration.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.configuration;
+
+import java.io.Serializable;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.core.Appender;
+import org.apache.logging.log4j.core.Layout;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.appender.ConsoleAppender;
+import org.apache.logging.log4j.core.config.AbstractConfiguration;
+import org.apache.logging.log4j.core.config.ConfigurationSource;
+import org.apache.logging.log4j.core.config.LoggerConfig;
+import org.apache.logging.log4j.core.layout.PatternLayout;
+import org.apache.logging.log4j.util.PropertiesUtil;
+
+/**
+ * This Configuration is the same as the DefaultConfiguration but shows how a custom configuration can be built
+ * programmatically
+ */
+public class CustomConfiguration extends AbstractConfiguration {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * The name of the default configuration.
+ */
+ public static final String CONFIG_NAME = "Custom";
+
+ /**
+ * The System Property used to specify the logging level.
+ */
+ public static final String DEFAULT_LEVEL = "org.apache.logging.log4j.level";
+ /**
+ * The default Pattern used for the default Layout.
+ */
+ public static final String DEFAULT_PATTERN = "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n";
+
+ public CustomConfiguration(final LoggerContext loggerContext) {
+ this(loggerContext, ConfigurationSource.NULL_SOURCE);
+ }
+
+ /**
+ * Constructor to create the default configuration.
+ */
+ public CustomConfiguration(final LoggerContext loggerContext, final ConfigurationSource source) {
+ super(loggerContext, source);
+
+ setName(CONFIG_NAME);
+ final Layout<? extends Serializable> layout = PatternLayout.newBuilder()
+ .withPattern(DEFAULT_PATTERN)
+ .withConfiguration(this)
+ .build();
+ final Appender appender = ConsoleAppender.createDefaultAppenderForLayout(layout);
+ appender.start();
+ addAppender(appender);
+ final LoggerConfig root = getRootLogger();
+ root.addAppender(appender, null, null);
+
+ final String levelName = PropertiesUtil.getProperties().getStringProperty(DEFAULT_LEVEL);
+ final Level level = levelName != null && Level.valueOf(levelName) != null ?
+ Level.valueOf(levelName) : Level.ERROR;
+ root.setLevel(level);
+ }
+
+ @Override
+ protected void doConfigure() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/log4j-samples-configuration/src/main/java/org/apache/logging/log4j/configuration/CustomConfigurationFactory.java
----------------------------------------------------------------------
diff --git a/log4j-samples/log4j-samples-configuration/src/main/java/org/apache/logging/log4j/configuration/CustomConfigurationFactory.java b/log4j-samples/log4j-samples-configuration/src/main/java/org/apache/logging/log4j/configuration/CustomConfigurationFactory.java
new file mode 100644
index 0000000..53b70c7
--- /dev/null
+++ b/log4j-samples/log4j-samples-configuration/src/main/java/org/apache/logging/log4j/configuration/CustomConfigurationFactory.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.configuration;
+
+import java.net.URI;
+
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.config.Configuration;
+import org.apache.logging.log4j.core.config.ConfigurationFactory;
+import org.apache.logging.log4j.core.config.ConfigurationSource;
+import org.apache.logging.log4j.core.config.Order;
+import org.apache.logging.log4j.core.config.plugins.Plugin;
+
+/**
+ * Factory to construct a CustomConfiguration.
+ */
+@Plugin(name = "CustomConfigurationFactory", category = ConfigurationFactory.CATEGORY)
+@Order(50)
+public class CustomConfigurationFactory extends ConfigurationFactory {
+
+ /**
+ * Valid file extensions for XML files.
+ */
+ public static final String[] SUFFIXES = new String[] {"*"};
+
+ /**
+ * Returns the Configuration.
+ * @param source The InputSource.
+ * @return The Configuration.
+ */
+ @Override
+ public Configuration getConfiguration(final LoggerContext loggerContext, final ConfigurationSource source) {
+ return new CustomConfiguration(loggerContext, source);
+ }
+
+ @Override
+ public Configuration getConfiguration(final LoggerContext loggerContext, final String name, final URI configLocation) {
+ return new CustomConfiguration(loggerContext);
+ }
+
+ /**
+ * Returns the file suffixes for XML files.
+ * @return An array of File extensions.
+ */
+ @Override
+ public String[] getSupportedTypes() {
+ return SUFFIXES;
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/log4j-samples-configuration/src/test/java/org/apache/logging/log4j/configuration/CustomConfigurationTest.java
----------------------------------------------------------------------
diff --git a/log4j-samples/log4j-samples-configuration/src/test/java/org/apache/logging/log4j/configuration/CustomConfigurationTest.java b/log4j-samples/log4j-samples-configuration/src/test/java/org/apache/logging/log4j/configuration/CustomConfigurationTest.java
new file mode 100644
index 0000000..054a0f3
--- /dev/null
+++ b/log4j-samples/log4j-samples-configuration/src/test/java/org/apache/logging/log4j/configuration/CustomConfigurationTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.configuration;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class CustomConfigurationTest {
+ private final Logger logger = LogManager.getLogger(CustomConfiguration.class);
+
+ @Test
+ public void testLogging() {
+ logger.error("This is a test");
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/log4j-samples-flume-common/.gitignore
----------------------------------------------------------------------
diff --git a/log4j-samples/log4j-samples-flume-common/.gitignore b/log4j-samples/log4j-samples-flume-common/.gitignore
new file mode 100644
index 0000000..9f0fc21
--- /dev/null
+++ b/log4j-samples/log4j-samples-flume-common/.gitignore
@@ -0,0 +1,4 @@
+/.settings/
+/target/
+/.classpath
+/.project
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/log4j-samples-flume-common/pom.xml
----------------------------------------------------------------------
diff --git a/log4j-samples/log4j-samples-flume-common/pom.xml b/log4j-samples/log4j-samples-flume-common/pom.xml
new file mode 100644
index 0000000..7643cb6
--- /dev/null
+++ b/log4j-samples/log4j-samples-flume-common/pom.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>log4j-samples</artifactId>
+ <groupId>org.apache.logging.log4j.samples</groupId>
+ <version>2.10.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>log4j-samples-flume-common</artifactId>
+ <packaging>jar</packaging>
+ <name>Apache Log4j Samples: Flume - Common</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.ws</groupId>
+ <artifactId>spring-ws-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.8.2</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/app/LogEventFactory.java
----------------------------------------------------------------------
diff --git a/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/app/LogEventFactory.java b/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/app/LogEventFactory.java
new file mode 100755
index 0000000..cc17609
--- /dev/null
+++ b/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/app/LogEventFactory.java
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.samples.app;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+import org.apache.logging.log4j.EventLogger;
+import org.apache.logging.log4j.message.StructuredDataMessage;
+import org.apache.logging.log4j.samples.dto.AuditEvent;
+import org.apache.logging.log4j.samples.dto.Constraint;
+import org.apache.logging.log4j.samples.util.NamingUtils;
+
+/**
+ *
+ */
+public class LogEventFactory {
+
+ @SuppressWarnings("unchecked")
+ public static <T extends AuditEvent> T getEvent(final Class<T> intrface) {
+
+ final String eventId = NamingUtils.lowerFirst(intrface.getSimpleName());
+ final StructuredDataMessage msg = new StructuredDataMessage(eventId, null, "Audit");
+ return (T)Proxy.newProxyInstance(intrface
+ .getClassLoader(), new Class<?>[]{intrface}, new AuditProxy(msg, intrface));
+ }
+
+ private static class AuditProxy implements InvocationHandler {
+
+ private final StructuredDataMessage msg;
+ private final Class<?> intrface;
+
+ public AuditProxy(final StructuredDataMessage msg, final Class<?> intrface) {
+ this.msg = msg;
+ this.intrface = intrface;
+ }
+
+ @Override
+ public Object invoke(final Object o, final Method method, final Object[] objects)
+ throws Throwable {
+ if (method.getName().equals("logEvent")) {
+
+ final StringBuilder missing = new StringBuilder();
+
+ final Method[] methods = intrface.getMethods();
+
+ for (final Method _method : methods) {
+ final String name = NamingUtils.lowerFirst(NamingUtils
+ .getMethodShortName(_method.getName()));
+
+ final Annotation[] annotations = _method.getDeclaredAnnotations();
+ for (final Annotation annotation : annotations) {
+ final Constraint constraint = (Constraint) annotation;
+
+ if (constraint.required() && msg.get(name) == null) {
+ if (missing.length() > 0) {
+ missing.append(", ");
+ }
+ missing.append(name);
+ }
+ }
+ }
+
+ if (missing.length() > 0) {
+ throw new IllegalStateException("Event " + msg.getId().getName() +
+ " is missing required attributes " + missing);
+ }
+ EventLogger.logEvent(msg);
+ }
+ if (method.getName().equals("setCompletionStatus")) {
+ final String name = NamingUtils.lowerFirst(NamingUtils.getMethodShortName(method.getName()));
+ msg.put(name, objects[0].toString());
+ }
+ if (method.getName().startsWith("set")) {
+ final String name = NamingUtils.lowerFirst(NamingUtils.getMethodShortName(method.getName()));
+
+ /*
+ * Perform any validation here. Currently the catalog doesn't
+ * contain any information on validation rules.
+ */
+ msg.put(name, objects[0].toString());
+ }
+
+ return null;
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/app/LoggingApp.java
----------------------------------------------------------------------
diff --git a/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/app/LoggingApp.java b/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/app/LoggingApp.java
new file mode 100644
index 0000000..944082f
--- /dev/null
+++ b/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/app/LoggingApp.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.samples.app;
+
+import java.util.List;
+import java.util.Random;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.ThreadContext;
+import org.apache.logging.log4j.samples.dto.AuditEvent;
+import org.apache.logging.log4j.samples.dto.RequestContext;
+
+
+/**
+ * The Class LoggingApp.
+ */
+public class LoggingApp {
+
+ /**
+ * The logger.
+ */
+ private static Logger logger = LogManager.getLogger(LoggingApp.class);
+
+ private final Random ran = new Random();
+
+ private List<AuditEvent> events;
+
+ public static void main(final String[] args) {
+ String member = "fakemember";
+ if (args.length == 1) {
+ member = args[0];
+ }
+ final LoggingApp app = new LoggingApp(member);
+ app.runApp(member);
+ System.out.println("Job ended");
+ }
+
+ public LoggingApp(final String member) {
+
+ ThreadContext.clearMap();
+
+ RequestContext.setSessionId("session1234");
+ RequestContext.setIpAddress("127.0.0.1");
+ RequestContext.setClientId("02121");
+ RequestContext.setProductName("IB");
+ RequestContext.setProductVersion("4.18.1");
+ RequestContext.setLocale("en_US");
+ RequestContext.setRegion("prod");
+
+ if (events == null) {
+ events = MockEventsSupplier.getAllEvents(member);
+ }
+ }
+
+ public void runApp(final String member) {
+ final Worker worker = new Worker(member);
+ worker.start();
+ sleep(30000);
+ worker.shutdown();
+ sleep(5000);
+ }
+
+ private void sleep(final long millis) {
+ try {
+ Thread.sleep(millis);
+ } catch (final InterruptedException ie) {
+ //
+ }
+ }
+
+
+ public class Worker extends Thread {
+
+ private final String member;
+
+ private boolean shutdown = false;
+
+ public Worker(final String member) {
+ this.member = member;
+ }
+
+ @Override
+ public void run() {
+ System.out.println("STARTING..................");
+
+ while (!shutdown) {
+ // Generate rand number between 1 to 10
+ final int rand = ran.nextInt(9) + 1;
+
+ // Sleep for rand seconds
+ try {
+ Thread.sleep(rand * 1000);
+ } catch (final InterruptedException e) {
+ logger.warn("WARN", e);
+ }
+
+ // Write rand number of logs
+ for (int i = 0; i < rand; i++) {
+ final int eventIndex = (Math.abs(ran.nextInt())) % events.size();
+ final AuditEvent event = events.get(eventIndex);
+ RequestContext.setUserId(member);
+ event.logEvent();
+
+ if ((rand % 4) == 1) {
+ logger.debug("DEBUG level logging.....");
+ } else if ((rand % 4) == 2) {
+ logger.info("INFO level logging.....");
+ } else if ((rand % 4) == 3) {
+ logger.warn("WARN level logging.....");
+ } else {
+ logger.error("ERROR level logging.....");
+ }
+ }
+
+ }
+ }
+
+ public void shutdown() {
+ this.shutdown = true;
+ try {
+ this.join();
+ } catch (final InterruptedException ie) {
+ //
+ }
+ System.out.println("SHUTDOWN.......................");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/app/LoggingController.java
----------------------------------------------------------------------
diff --git a/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/app/LoggingController.java b/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/app/LoggingController.java
new file mode 100755
index 0000000..e77650a
--- /dev/null
+++ b/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/app/LoggingController.java
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.samples.app;
+
+import java.util.List;
+import java.util.Random;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.ThreadContext;
+import org.apache.logging.log4j.samples.dto.AuditEvent;
+import org.apache.logging.log4j.samples.dto.RequestContext;
+import org.apache.logging.log4j.util.Strings;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.ModelAndView;
+
+
+/**
+ * The Class LoggingController.
+ */
+@Controller
+public class LoggingController {
+
+ /**
+ * The logger.
+ */
+ private static Logger logger = LogManager.getLogger(LoggingController.class);
+
+ private volatile boolean generateLog = false;
+ private final Random ran = new Random();
+
+ private List<AuditEvent> events;
+ private int timeBase = 1000;
+
+ @RequestMapping(value = "/start.do", method = RequestMethod.GET)
+ public ModelAndView startLogging(
+ @RequestParam(value = "member", required = false, defaultValue = "fakemember") final String member,
+ @RequestParam(value = "interval", required = false, defaultValue = "1000") final String interval,
+ @RequestParam(value = "threads", required = false, defaultValue = "1") final String threadCount,
+ final HttpServletRequest servletRequest) {
+ int numThreads = 1;
+ if (Strings.isNotEmpty(threadCount)) {
+ try {
+ numThreads = Integer.parseInt(threadCount);
+ } catch (final Exception ex) {
+ System.out.println("Invalid threadCount specified: " + threadCount);
+ }
+ }
+ if (Strings.isNotEmpty(interval)) {
+ try {
+ timeBase = Integer.parseInt(interval);
+ } catch (final Exception ex) {
+ System.out.println("Invalid interval specified: " + interval);
+ }
+ }
+ System.out.println("STARTING - Using " + numThreads + " threads at interval: " + timeBase);
+
+ if (events == null) {
+ events = MockEventsSupplier.getAllEvents(member);
+ }
+
+ generateLog = true;
+
+ for (int i = 0; i < numThreads; ++i) {
+ (new Thread() {
+
+ @Override
+ public void run() {
+ ThreadContext.clearMap();
+
+ RequestContext.setSessionId("session1234");
+ RequestContext.setIpAddress("127.0.0.1");
+ RequestContext.setClientId("02121");
+ RequestContext.setProductName("IB");
+ RequestContext.setProductVersion("4.18.1");
+ RequestContext.setLocale("en_US");
+ RequestContext.setRegion("prod");
+ while (generateLog) {
+ // Generate rand number between 1 to 10
+ final int rand = ran.nextInt(9) + 1;
+
+ // Sleep for rand seconds
+ try {
+ Thread.sleep(rand * timeBase);
+ } catch (final InterruptedException e) {
+ logger.warn("WARN", e);
+ }
+
+ // Write rand number of logs
+ for (int i = 0; i < rand; i++) {
+ final int eventIndex = (Math.abs(ran.nextInt())) % events.size();
+ final AuditEvent event = events.get(eventIndex);
+ RequestContext.setUserId(member);
+ event.logEvent();
+
+ if ((rand % 4) == 1) {
+ logger.debug("DEBUG level logging.....");
+ } else if ((rand % 4) == 2) {
+ logger.info("INFO level logging.....");
+ } else if ((rand % 4) == 3) {
+ logger.warn("WARN level logging.....");
+ } else {
+ logger.error("ERROR level logging.....");
+ }
+ }
+
+ }
+ ThreadContext.cloneStack();
+ }
+ }).start();
+ }
+
+ return new ModelAndView("start.jsp");
+ }
+
+ @RequestMapping(value = "/stop.do", method = RequestMethod.GET)
+ public ModelAndView stopLogging(final HttpServletRequest servletRequest) {
+ generateLog = false;
+ return new ModelAndView("stop.jsp");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/app/MockEventsSupplier.java
----------------------------------------------------------------------
diff --git a/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/app/MockEventsSupplier.java b/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/app/MockEventsSupplier.java
new file mode 100755
index 0000000..bdd64b4
--- /dev/null
+++ b/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/app/MockEventsSupplier.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.samples.app;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+import org.apache.logging.log4j.samples.dto.AuditEvent;
+import org.apache.logging.log4j.samples.events.Alert;
+import org.apache.logging.log4j.samples.events.ChangePassword;
+import org.apache.logging.log4j.samples.events.Login;
+import org.apache.logging.log4j.samples.events.ScheduledTransaction;
+import org.apache.logging.log4j.samples.events.Transfer;
+
+public class MockEventsSupplier {
+
+ /* This provides random generation */
+ static Random random = new Random();
+
+ public static List<AuditEvent> getAllEvents(final String member) {
+
+ final List<AuditEvent> events = new ArrayList<>();
+
+
+ final Login login = LogEventFactory.getEvent(Login.class);
+ login.setStartPageOption("account summary");
+ login.setSource("online");
+ login.setMember(member);
+ events.add(login);
+
+ final ChangePassword changePassword = LogEventFactory.getEvent(ChangePassword.class);
+ changePassword.setMember(member);
+ events.add(changePassword);
+
+ final Transfer transfer = LogEventFactory.getEvent(Transfer.class);
+
+ transfer.setAmount("4251");
+ transfer.setFromAccount("REPLACE"); // getAccount(mbr, accounts));
+ transfer.setToAccount("31142553");
+ transfer.setReference("DI-2415220110804");
+ transfer.setComment("My Transfer");
+ transfer.setMemo("For dinner");
+ transfer.setPayment("Use Checking");
+ transfer.setTransactionType("1");
+ transfer.setSource("IB Transfer page");
+ transfer.setCompletionStatus("complete");
+ transfer.setMember(member);
+ events.add(transfer);
+
+ final Alert alert = LogEventFactory.getEvent(Alert.class);
+
+ alert.setAction("add");
+ alert.setType("balance alert");
+ alert.setAccountNumber("REPLACE"); // , getAccount(mbr, accounts));
+ alert.setTrigger("GT");
+ alert.setThreshold("1000");
+ alert.setMember(member);
+ events.add(alert);
+
+ final ScheduledTransaction scheduledTransaction = LogEventFactory
+ .getEvent(ScheduledTransaction.class);
+
+ scheduledTransaction.setAction("add");
+ scheduledTransaction.setFromAccount("REPLACE"); // getAccount(mbr,
+ // accounts));
+ scheduledTransaction.setToAccount("REPLACE"); // "9200000214");
+ scheduledTransaction.setAmount("2541");
+ scheduledTransaction.setStartDate("20110105");
+ scheduledTransaction.setMember("256");
+ scheduledTransaction.setFrequency("4");
+ scheduledTransaction.setMemo("Scheduled Transfer");
+ scheduledTransaction.setPayment("3456");
+ scheduledTransaction.setCompletionNotification("Was completed");
+ scheduledTransaction.setEndDate("2020-05-30");
+ scheduledTransaction.setSrtId("Calabasas2341");
+ scheduledTransaction.setSource("Home Page");
+ scheduledTransaction.setCompletionStatus("success");
+ scheduledTransaction.setMember(member);
+ events.add(scheduledTransaction);
+
+ return events;
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/dto/AuditEvent.java
----------------------------------------------------------------------
diff --git a/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/dto/AuditEvent.java b/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/dto/AuditEvent.java
new file mode 100755
index 0000000..67694e6
--- /dev/null
+++ b/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/dto/AuditEvent.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.samples.dto;
+
+/**
+ * Interface that indicates the Class was generated by the DTOManager.
+ */
+public interface AuditEvent {
+
+ void logEvent();
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/dto/Constraint.java
----------------------------------------------------------------------
diff --git a/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/dto/Constraint.java b/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/dto/Constraint.java
new file mode 100755
index 0000000..c0e83cf
--- /dev/null
+++ b/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/dto/Constraint.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.samples.dto;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.apache.logging.log4j.util.Strings;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Constraint {
+
+ boolean required() default false;
+
+ String pattern() default Strings.EMPTY;
+
+ int minLength() default -1;
+
+ int maxLength() default -1;
+
+ int totalDigits() default -1;
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/fb97e2b6/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/dto/RequestContext.java
----------------------------------------------------------------------
diff --git a/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/dto/RequestContext.java b/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/dto/RequestContext.java
new file mode 100644
index 0000000..f7b6fc5
--- /dev/null
+++ b/log4j-samples/log4j-samples-flume-common/src/main/java/org/apache/logging/log4j/samples/dto/RequestContext.java
@@ -0,0 +1,172 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.samples.dto;
+
+import org.apache.logging.log4j.ThreadContext;
+import org.apache.logging.log4j.core.util.UuidUtil;
+
+/**
+ *
+ */
+public final class RequestContext {
+
+ private RequestContext() {
+ }
+ // Unique token to identify this request.
+ public static final String REQUEST_ID = "id";
+ // Token used to correlate multiple events within the request.
+ public static final String TRANSACTION_ID = "transId";
+ // The requested resource.
+ public static final String REQUEST_URI = "requestURI";
+ // Identify the user's session - should never contain the HTTP SessionId.
+ public static final String SESSION_ID = "sessionId";
+ // The id the user logged in with.
+ public static final String LOGIN_ID = "loginId";
+ // The id the system associates with the user.
+ public static final String USER_ID = "userId";
+ // user, admin, etc.
+ public static final String USER_TYPE = "userType";
+ // client id in a multi-tenant application
+ public static final String CLIENT_ID = "clientId";
+ // The user's ipAddress.
+ public static final String IP_ADDRESS = "ipAddress";
+ // The name of the product.
+ public static final String PRODUCT_NAME = "productName";
+ // The product version.
+ public static final String PRODUCT_VERSION = "productVersion";
+ // The users locale.
+ public static final String LOCALE = "locale";
+ // prod, preprod, beta, dev, etc.
+ public static final String REGION = "region";
+ // The user agent string from the browser.
+ public static final String USER_AGENT = "userAgent";
+
+ public static void initialize() {
+ ThreadContext.clearMap();
+ ThreadContext.put(REQUEST_ID, UuidUtil.getTimeBasedUuid().toString());
+ }
+
+ public static String getId() {
+ return ThreadContext.get(REQUEST_ID);
+ }
+
+ public static void setSessionId(final String id) {
+ ThreadContext.put(SESSION_ID, id);
+ }
+
+ public static String getSessionId() {
+ return ThreadContext.get(SESSION_ID);
+ }
+
+ public static void setTransId(final String id) {
+ ThreadContext.put(TRANSACTION_ID, id);
+ }
+
+ public static String getTransId() {
+ return ThreadContext.get(TRANSACTION_ID);
+ }
+
+ public static void setRequestURI(final String URI) {
+ ThreadContext.put(REQUEST_URI, URI);
+ }
+
+ public static String getRequestURI() {
+ return ThreadContext.get(REQUEST_URI);
+ }
+
+ public static void setLoginId(final String id) {
+ ThreadContext.put(LOGIN_ID, id);
+ }
+
+ public static String getLoginId() {
+ return ThreadContext.get(LOGIN_ID);
+ }
+
+ public static void setUserId(final String id) {
+ ThreadContext.put(USER_ID, id);
+ }
+
+ public static String getUserId() {
+ return ThreadContext.get(USER_ID);
+ }
+
+ public static void setUserType(final String type) {
+ ThreadContext.put(USER_TYPE, type);
+ }
+
+ public static String getUserType() {
+ return ThreadContext.get(USER_TYPE);
+ }
+
+ public static void setClientId(final String id) {
+ ThreadContext.put(CLIENT_ID, id);
+ }
+
+ public static String getClientId() {
+ return ThreadContext.get(CLIENT_ID);
+ }
+
+ public static void setIpAddress(final String addr) {
+ ThreadContext.put(IP_ADDRESS, addr);
+ }
+
+ public static String getIpAddress() {
+ return ThreadContext.get(IP_ADDRESS);
+ }
+
+ public static void setProductName(final String productName) {
+ ThreadContext.put(PRODUCT_NAME, productName);
+ }
+
+ public static String getProductName() {
+ return ThreadContext.get(PRODUCT_NAME);
+ }
+
+
+ public static void setProductVersion(final String productVersion) {
+ ThreadContext.put(PRODUCT_VERSION, productVersion);
+ }
+
+ public static String getProductVersion() {
+ return ThreadContext.get(PRODUCT_VERSION);
+ }
+
+ public static void setLocale(final String locale) {
+ ThreadContext.put(LOCALE, locale);
+ }
+
+ public static String getLocale() {
+ return ThreadContext.get(LOCALE);
+ }
+
+ public static void setRegion(final String region) {
+ ThreadContext.put(REGION, region);
+ }
+
+ public static String getRegion() {
+ return ThreadContext.get(REGION);
+ }
+
+ public static void setUserAgent(final String agent) {
+ ThreadContext.put(USER_AGENT, agent);
+ }
+
+ public static String getUserAgent() {
+ return ThreadContext.get(USER_AGENT);
+ }
+
+}