Commit ed6badcc authored by Emmanuel Bourg's avatar Emmanuel Bourg

New upstream version 2.8.2

parent 3c1cf1c0
# 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
.idea
**/*.iml
**/target
target/
.settings
.classpath
.cache-main
.cache-tests
velocity.log
felix-cache/
bin/
mvnw.cmd eol=crlf
# 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
.idea
**/*.iml
......
# 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.
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip
\ No newline at end of file
# Licensed 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.
language: java
sudo: false
jdk:
- oraclejdk7
after_success:
- mvn --show-version -pl !log4j-bom jacoco:prepare-agent test jacoco:report coveralls:report
Building Log4j 2
<!---
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.
-->
# Building Log4j 2
To build Log4j 2, you need a JDK implementation version 1.7 or greater, and Apache Maven.
Note that building the site requires Maven 3.0.5, while everything else works
......@@ -6,46 +22,47 @@ fine with any version of Maven 3.
To perform the license release audit, a.k.a. "RAT check", run.
mvn apache-rat:check
mvn apache-rat:check
To perform a Clirr check on the API module, run
mvn clirr:check -pl log4j-api
mvn clirr:check -pl log4j-api
To build the site with Java 7, make sure you give Maven enough memory using
MAVEN_OPTS with options appropriate for your JVM. Alternatively, you can
build with Java 8 and not deal with MAVEN_OPTS.
`MAVEN_OPTS` with options appropriate for your JVM. Alternatively, you can
build with Java 8 and not deal with `MAVEN_OPTS`.
To install the jars in your local Maven repository, from a command line, run:
mvn clean install
mvn clean install
Once install is run, you can run the Clirr check on the 1.2 API module:
mvn clirr:check -pl log4j-1.2-api
mvn clirr:check -pl log4j-1.2-api
Next, to build the site:
mvn site
If Java 7 runs out of memory building the site, you will need:
set MAVEN_OPTS=-Xmx2000m -XX:MaxPermSize=384m
mvn site
On Windows, use a local staging directory, for example:
mvn site:stage-deploy -DstagingSiteURL=file:///%HOME%/log4j
mvn site:stage-deploy -DstagingSiteURL=file:///%HOME%/log4j
On UNIX, use a local staging directory, for example:
mvn site:stage-deploy -DstagingSiteURL=file:///$HOME/log4j
mvn site:stage-deploy -DstagingSiteURL=file:///$HOME/log4j
To test, run:
mvn test
Then, to test OSGi, you must first create the jars:
mvn clean install
mvn install -DskipTests
mvn package -DskipTests
## Testing in Docker
Next, you can run the tests as usual, which will pick up the jar files to use as OSGi bundles from the various target
directories:
In order to run a clean test using the minimum version of the JDK along with a
proper Linux environment, run:
mvn test
docker build .
<!---
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.
-->
<!--
This looks like it was generated, but it was actually modified from the
CONTRIBUTING.md file from Apache Commons Lang.
-->
# Contributing to Apache Log4j 2
You have found a bug or you have an idea for a cool new feature? Contributing code is a great way to give something back to
the open source community. Before you dig right into the code there are a few guidelines that we need contributors to
follow so that we can have a chance of keeping on top of things.
## Getting Started
+ Make sure you have a [JIRA account](https://issues.apache.org/jira/).
+ Make sure you have a [GitHub account](https://github.com/signup/free).
+ If you're planning to implement a new feature it makes sense to discuss your changes on the [dev list](https://logging.apache.org/log4j/2.x/mail-lists.html) first. This way you can make sure you're not wasting your time on something that isn't considered to be in Apache Log4j's scope.
+ Submit a ticket for your issue, assuming one does not already exist.
+ Clearly describe the issue including steps to reproduce when it is a bug.
+ Make sure you fill in the earliest version that you know has the issue.
+ Fork the repository on GitHub.
## Making Changes
+ Create a topic branch from where you want to base your work (this is usually the master branch).
+ Make commits of logical units.
+ Respect the original code style:
+ Only use spaces for indentation.
+ Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
+ Check for unnecessary whitespace with git diff --check before committing.
+ Make sure your commit messages are in the proper format. Your commit message should contain the key of the JIRA issue.
+ Make sure you have added the necessary tests for your changes.
+ Run all the tests with `mvn clean verify` to assure nothing else was accidentally broken.
## Making Trivial Changes
For changes of a trivial nature to comments and documentation, it is not always necessary to create a new ticket in JIRA.
In this case, it is appropriate to start the first line of a commit with '(doc)' instead of a ticket number.
## Submitting Changes
+ Sign the [Contributor License Agreement][cla] if you haven't already.
+ Push your changes to a topic branch in your fork of the repository.
+ Submit a pull request to the repository in the apache organization.
+ Update your JIRA ticket and include a link to the pull request in the ticket.
## Additional Resources
+ [Project Guidelines](https://logging.apache.org/log4j/2.x/guidelines.html)
+ [Code Style Guide](https://logging.apache.org/log4j/2.x/javastyle.html)
+ [Apache Log4j 2 JIRA project page](https://issues.apache.org/jira/browse/LOG4J2)
+ [Contributor License Agreement][cla]
+ [General GitHub documentation](https://help.github.com/)
+ [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
[cla]:https://www.apache.org/licenses/#clas
# 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.
FROM openjdk:7-alpine
RUN set -ex \
&& mkdir /src \
&& apk update \
&& apk add curl \
&& mkdir /opt \
&& cd /opt \
&& curl -fsSL http://www-us.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz -o maven.tar.gz \
&& tar -xzf maven.tar.gz \
&& rm -f maven.tar.gz
COPY . /src
RUN set -ex \
&& cd /src \
&& /opt/apache-maven-3.3.9/bin/mvn verify
Apache Log4j
Copyright 1999-2016 Apache Software Foundation
Copyright 1999-2017 Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
......
# [Apache Log4j 2](http://logging.apache.org/log4j/2.x/)
# [Apache Log4j 2](https://logging.apache.org/log4j/2.x/)
Apache Log4j 2 is an upgrade to Log4j that provides significant improvements over its predecessor, Log4j 1.x,
and provides many of the improvements available in Logback while fixing some inherent problems in Logback's architecture.
[![Jenkins Status](https://builds.apache.org/buildStatus/icon?job=Log4j 2.x)](https://builds.apache.org/job/Log4j%202.x/)
[![Travis Status](https://travis-ci.org/apache/logging-log4j2.svg?branch=master)](https://travis-ci.org/apache/logging-log4j2)
[![Coverage Status](https://coveralls.io/repos/github/apache/logging-log4j2/badge.svg?branch=master)](https://coveralls.io/github/apache/logging-log4j2?branch=master)
## Usage
Maven users can add the following dependencies to their `pom.xml` file:
```xml
<dependencies>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8</version>
</dependency>
</dependencies>
```
Gradle users can add the following to their `build.gradle` file:
```gradle
dependencies {
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.8'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.8'
}
```
Basic usage of the `Logger` API:
```java
package com.example;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
public class Example {
private static final Logger LOGGER = LogManager.getLogger();
public static void main(String... args) {
String thing = args.length > 0 ? args[0] : "world";
LOGGER.info("Hello, {}!", thing);
LOGGER.debug("Got calculated value only if debug enabled: {}", () -> doSomeCalculation());
}
private static Object doSomeCalculation() {
// do some complicated calculation
<