Scala API sample
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/06e4b185 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/06e4b185 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/06e4b185 Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure Commit: 06e4b1852d3b3a24045f85ad26e7a0ec80d115c1 Parents: 245cc32 Author: Mikael Ståldal <mik...@staldal.nu> Authored: Mon Jun 27 16:01:11 2016 +0200 Committer: Mikael Ståldal <mik...@staldal.nu> Committed: Mon Jun 27 16:01:11 2016 +0200 ---------------------------------------------------------------------- log4j-samples/pom.xml | 1 + log4j-samples/scala-api/pom.xml | 65 ++++++++++++++++++++ .../scala-api/src/main/resources/log4j2.xml | 32 ++++++++++ .../logging/log4j/scalasample/LoggingApp.scala | 10 +++ pom.xml | 10 +++ 5 files changed, 118 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/06e4b185/log4j-samples/pom.xml ---------------------------------------------------------------------- diff --git a/log4j-samples/pom.xml b/log4j-samples/pom.xml index 0da9a2b..33481c6 100644 --- a/log4j-samples/pom.xml +++ b/log4j-samples/pom.xml @@ -83,6 +83,7 @@ <module>flume-embedded</module> <module>configuration</module> <module>loggerProperties</module> + <module>scala-api</module> </modules> <build> <plugins> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/06e4b185/log4j-samples/scala-api/pom.xml ---------------------------------------------------------------------- diff --git a/log4j-samples/scala-api/pom.xml b/log4j-samples/scala-api/pom.xml new file mode 100644 index 0000000..a0f87ab --- /dev/null +++ b/log4j-samples/scala-api/pom.xml @@ -0,0 +1,65 @@ +<?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.6.2-SNAPSHOT</version> + </parent> + <artifactId>log4j-samples-scala-api</artifactId> + <packaging>jar</packaging> + <name>Apache Log4j Samples: Scala API</name> + <url>http://http://logging.apache.org/log4j/2.x/</url> + <properties> + <scala.version>2.11.7</scala.version> + <scala.maven.plugin.version>3.2.2</scala.maven.plugin.version> + </properties> + <dependencies> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api-scala_2.11</artifactId> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <scope>runtime</scope> + </dependency> + </dependencies> + <build> + <sourceDirectory>src/main/scala</sourceDirectory> + <plugins> + <plugin> + <groupId>net.alchim31.maven</groupId> + <artifactId>scala-maven-plugin</artifactId> + <version>${scala.maven.plugin.version}</version> + <executions> + <execution> + <goals> + <goal>compile</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/06e4b185/log4j-samples/scala-api/src/main/resources/log4j2.xml ---------------------------------------------------------------------- diff --git a/log4j-samples/scala-api/src/main/resources/log4j2.xml b/log4j-samples/scala-api/src/main/resources/log4j2.xml new file mode 100644 index 0000000..f5b89b4 --- /dev/null +++ b/log4j-samples/scala-api/src/main/resources/log4j2.xml @@ -0,0 +1,32 @@ +<?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 name="ScalaApiSample" status="error"> + <Appenders> + <Console name="Console"> + <PatternLayout> + <Pattern>%d %5p [%t] %c{1} %X - %m%n</Pattern> + </PatternLayout> + </Console> + </Appenders> + <Loggers> + <Root level="INFO"> + <AppenderRef ref="Console"/> + </Root> + </Loggers> +</Configuration> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/06e4b185/log4j-samples/scala-api/src/main/scala/org/apache/logging/log4j/scalasample/LoggingApp.scala ---------------------------------------------------------------------- diff --git a/log4j-samples/scala-api/src/main/scala/org/apache/logging/log4j/scalasample/LoggingApp.scala b/log4j-samples/scala-api/src/main/scala/org/apache/logging/log4j/scalasample/LoggingApp.scala new file mode 100644 index 0000000..b50c83b --- /dev/null +++ b/log4j-samples/scala-api/src/main/scala/org/apache/logging/log4j/scalasample/LoggingApp.scala @@ -0,0 +1,10 @@ +package org.apache.logging.log4j.scalasample + +import org.apache.logging.log4j.scala.Logging + +object LoggingApp extends App with Logging { + + val i = 17 + logger.info(s"Hello, world: $i") + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/06e4b185/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 00416d5..7897e5a 100644 --- a/pom.xml +++ b/pom.xml @@ -372,6 +372,16 @@ <version>${project.version}</version> </dependency> <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api-scala_2.10</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api-scala_2.11</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> <groupId>com.sleepycat</groupId> <artifactId>je</artifactId> <version>5.0.73</version>