The information below is for developers who want to modify Log4j or contribute to Log4j. If your goal is to add logging to your application you don't need to build from the source code, you can download the pre-built binaries instead.
Log4j 2 is hosted in the Apache Software Foundation's Git repository. Details on obtaining the most current source code can be found at Log4j Source Repository. The source from the latest release may be obtained by downloading it using the instructions at Log4j Downloads.
Log4j 2.x uses Maven 3 as its build tool. To build and install Log4j in your local Maven cache, from the root directory run: mvn install
Then to build the full site, you must use a local staging directory:
mvn site [Windows] mvn site:stage-deploy -DstagingSiteURL=file:///%HOME%/log4j [Unix] mvn site:stage-deploy -DstagingSiteURL=file:///$HOME/log4j
To rebuild only what's changed and execute the tests, run: mvn test
To rebuild from scratch, add "clean", for example: mvn clean test
Please see the wiki Log4j2ReleaseGuide.