|
15 | 15 | limitations under the License.
|
16 | 16 | ////
|
17 | 17 |
|
18 |
| -= Install Apache Log4j |
| 18 | += Download |
19 | 19 |
|
20 |
| -Apache Log4j is distributed under the |
21 |
| -https://www.apache.org/licenses/LICENSE-2.0.html[Apache License, version 2.0]. |
| 20 | +You can manually download all published Log4j distributions, verify them, and see their licensing information by following the instructions in {logging-services-url}/download.html[the Download page] of {logging-services-url}[Logging Services]. |
22 | 21 |
|
23 |
| -[#using-a-build-system] |
24 |
| -== Using a build system |
25 |
| -
|
26 |
| -The preferred way to use Log4j in your project is to use a build system as Maven. |
27 |
| -Please add the following to your build systems configuration file `pom.xml` to use Log4j. |
28 |
| -
|
29 |
| -Log4j needs two dependencies, since it is separated between the API and the Core. |
30 |
| -
|
31 |
| -[tabs%sync] |
32 |
| -==== |
33 |
| -Maven:: |
34 |
| -+ |
35 |
| -.`pom.xml` snippet |
36 |
| -[source,xml,subs="+attributes"] |
37 |
| ----- |
38 |
| -<dependencies> |
39 |
| - <dependency> |
40 |
| - <groupId>org.apache.logging.log4j</groupId> |
41 |
| - <artifactId>log4j-api</artifactId> |
42 |
| - <version>{log4j-api-version}</version> |
43 |
| - </dependency> |
44 |
| - <dependency> |
45 |
| - <groupId>org.apache.logging.log4j</groupId> |
46 |
| - <artifactId>log4j-core</artifactId> |
47 |
| - <version>{log4j-core-version}</version> |
48 |
| - </dependency> |
49 |
| -</dependencies> |
50 |
| ----- |
51 |
| -
|
52 |
| -Gradle:: |
53 |
| -+ |
54 |
| -.`build.gradle` snippet |
55 |
| -[source,subs="+attributes"] |
56 |
| ----- |
57 |
| -compile 'org.apache.logging.log4j:log4j-api:{log4j-api-version}' |
58 |
| -compile 'org.apache.logging.log4j:log4j-core:{log4j-core-version}' |
59 |
| ----- |
60 |
| -
|
61 |
| -Ivy:: |
62 |
| -+ |
63 |
| -.`ivy.xml` snippet |
64 |
| -[source,xml,subs="+attributes"] |
65 |
| ----- |
66 |
| -<dependencies> |
67 |
| - <dependency org="org.apache.logging.log4j" name="log4j-api" rev="{log4j-api-version}" /> |
68 |
| - <dependency org="org.apache.logging.log4j" name="log4j-core" rev="{log4j-core-version}" /> |
69 |
| -</dependencies> |
70 |
| ----- |
71 |
| -==== |
72 |
| -
|
73 |
| -== Bill of materials |
74 |
| -
|
75 |
| -To keep your Log4j module versions in sync with each other, a BOM (Bill of Material) |
76 |
| -pom.xml file is provided for your convenience. To use this with https://maven.apache.org/[Maven], |
77 |
| -add the dependency listed below to your `pom.xml` file. |
78 |
| -When you specify the version identifier in this section, you don't have to specify the version in your `<dependencies/>` section. |
79 |
| -
|
80 |
| -[tabs%sync] |
81 |
| -==== |
82 |
| -Maven:: |
83 |
| -+ |
84 |
| -.`pom.xml` snippet |
85 |
| -[source,xml,subs="+attributes"] |
86 |
| ----- |
87 |
| -<dependencyManagement> |
88 |
| - <dependencies> |
89 |
| - <dependency> |
90 |
| - <groupId>org.apache.logging.log4j</groupId> |
91 |
| - <artifactId>log4j-bom</artifactId> |
92 |
| - <version>{log4j-core-version}</version> |
93 |
| - <scope>import</scope> |
94 |
| - <type>pom</type> |
95 |
| - </dependency> |
96 |
| - </dependencies> |
97 |
| -</dependencyManagement> |
98 |
| ----- |
99 |
| -
|
100 |
| -Gradle:: |
101 |
| -+ |
102 |
| -.`build.gradle` snippet |
103 |
| -[source,subs="+attributes"] |
104 |
| ----- |
105 |
| -plugins { |
106 |
| - id 'io.spring.dependency-management' version '1.0.1.RELEASE' //<1> |
107 |
| -} |
108 |
| -
|
109 |
| -dependencyManagement { |
110 |
| - imports { |
111 |
| - mavenBom 'org.apache.logging.log4j:log4j-bom:{log4j-core-version}' |
112 |
| - } |
113 |
| -} |
114 |
| -
|
115 |
| -dependencies { |
116 |
| - implementation 'org.apache.logging.log4j:log4j-api' |
117 |
| - implementation 'org.apache.logging.log4j:log4j-core' |
118 |
| - // etc. |
119 |
| -} |
120 |
| ----- |
121 |
| -<1> The additional https://github.com/spring-gradle-plugins/dependency-management-plugin[Gradle plugin] required for dependency management functionality. |
122 |
| -==== |
123 |
| -
|
124 |
| -== Snapshot builds |
125 |
| -
|
126 |
| -You can access the latest development snapshot by using the Maven repository |
127 |
| -`https://repository.apache.org/snapshots` and the current SNAPSHOT version. |
128 |
| -Generally, the master branch will use the next patch version as its snapshot |
129 |
| -version regardless of what the next actual version of Log4j will be. For example, |
130 |
| -if the latest release were `3.0`, then master would be using the version |
131 |
| -`3.0.1-SNAPSHOT`. |
132 |
| -
|
133 |
| -To enable snapshots you'll need to enable Snapshots repositories in your build system. |
134 |
| -
|
135 |
| -[tabs%sync] |
136 |
| -==== |
137 |
| -Maven:: |
138 |
| -+ |
139 |
| -.`pom.xml` snippet |
140 |
| -[source,xml,subs="+attributes"] |
141 |
| ----- |
142 |
| -<repositories> |
143 |
| - <repository> |
144 |
| - <id>apache.snapshots</id> |
145 |
| - <name>Apache Snapshot Repository</name> |
146 |
| - <url>https://repository.apache.org/snapshots</url> |
147 |
| - <releases> |
148 |
| - <enabled>false</enabled> |
149 |
| - </releases> |
150 |
| - </repository> |
151 |
| -</repositories> |
152 |
| ----- |
153 |
| -
|
154 |
| -Gradle:: |
155 |
| -+ |
156 |
| -.`build.gradle` snippet |
157 |
| -[source,subs="+attributes"] |
158 |
| ----- |
159 |
| -repositories { |
160 |
| - mavenCentral() |
161 |
| - maven { url 'https://repository.apache.org/snapshots' } |
162 |
| -} |
163 |
| ----- |
164 |
| -
|
165 |
| -SBT:: |
166 |
| -+ |
167 |
| -.`build.sbt` snippet |
168 |
| -[source,subs="+attributes"] |
169 |
| ----- |
170 |
| -resolvers += "Apache Snapshot Repository" at "https://repository.apache.org/snapshots" |
171 |
| ----- |
172 |
| -==== |
173 |
| -
|
174 |
| -== Manual Download |
175 |
| -
|
176 |
| -The link in the Mirrors column should display a list of available |
177 |
| -mirrors with a default selection based on your inferred location. If you |
178 |
| -do not see that page, try a different browser. The checksum and |
179 |
| -signature are links to the originals on the main distribution server. |
180 |
| -
|
181 |
| -|=== |
182 |
| -|Distribution |Mirrors |Checksum |Signature |
183 |
| -
|
184 |
| -|Apache Log4j binary (tar.gz) |
185 |
| -|https://www.apache.org/dyn/closer.lua/logging/log4j/{log4j-core-version}/apache-log4j-{log4j-core-version}-bin.tar.gz[apache-log4j-{log4j-core-version}-bin.tar.gz] |
186 |
| -|https://www.apache.org/dist/logging/log4j/{log4j-core-version}/apache-log4j-{log4j-core-version}-bin.tar.gz.sha512[apache-log4j-{log4j-core-version}-bin.tar.gz.sha512] |
187 |
| -|https://www.apache.org/dist/logging/log4j/{log4j-core-version}/apache-log4j-{log4j-core-version}-bin.tar.gz.asc[apache-log4j-{log4j-core-version}-bin.tar.gz.asc] |
188 |
| -
|
189 |
| -|Apache Log4j binary (zip) |
190 |
| -|https://www.apache.org/dyn/closer.lua/logging/log4j/{log4j-core-version}/apache-log4j-{log4j-core-version}-bin.zip[apache-log4j-{log4j-core-version}-bin.zip] |
191 |
| -|https://www.apache.org/dist/logging/log4j/{log4j-core-version}/apache-log4j-{log4j-core-version}-bin.zip.sha512[apache-log4j-{log4j-core-version}-bin.zip.sha512] |
192 |
| -|https://www.apache.org/dist/logging/log4j/{log4j-core-version}/apache-log4j-{log4j-core-version}-bin.zip.asc[apache-log4j-{log4j-core-version}-bin.zip.asc] |
193 |
| -
|
194 |
| -|Apache Log4j source (tar.gz) |
195 |
| -|https://www.apache.org/dyn/closer.lua/logging/log4j/{log4j-core-version}/apache-log4j-{log4j-core-version}-src.tar.gz[apache-log4j-{log4j-core-version}-src.tar.gz] |
196 |
| -|https://www.apache.org/dist/logging/log4j/{log4j-core-version}/apache-log4j-{log4j-core-version}-src.tar.gz.sha512[apache-log4j-{log4j-core-version}-src.tar.gz.sha512] |
197 |
| -|https://www.apache.org/dist/logging/log4j/{log4j-core-version}/apache-log4j-{log4j-core-version}-src.tar.gz.asc[apache-log4j-{log4j-core-version}-src.tar.gz.asc] |
198 |
| -
|
199 |
| -|Apache Log4j source (zip) |
200 |
| -|https://www.apache.org/dyn/closer.lua/logging/log4j/{log4j-core-version}/apache-log4j-{log4j-core-version}-src.zip[apache-log4j-{log4j-core-version}-src.zip] |
201 |
| -|https://www.apache.org/dist/logging/log4j/{log4j-core-version}/apache-log4j-{log4j-core-version}-src.zip.sha512[apache-log4j-{log4j-core-version}-src.zip.sha512] |
202 |
| -|https://www.apache.org/dist/logging/log4j/{log4j-core-version}/apache-log4j-{log4j-core-version}-src.zip.asc[apache-log4j-{log4j-core-version}-src.zip.asc] |
203 |
| -|=== |
204 |
| -
|
205 |
| -It is essential that you verify the integrity of the downloaded files |
206 |
| -using the PGP or SHA512 signatures. Please read |
207 |
| -https://httpd.apache.org/dev/verification.html[Verifying Apache HTTP |
208 |
| -Server Releases] for more information on why you should verify our |
209 |
| -releases. |
210 |
| -
|
211 |
| -The PGP signatures can be verified using PGP or GPG. First download the |
212 |
| -https://downloads.apache.org/logging/KEYS[KEYS] as well as the asc |
213 |
| -signature file for the relevant distribution. Make sure you get these |
214 |
| -files from the https://www.apache.org/dist/logging/[main distribution |
215 |
| -directory], rather than from a mirror. Then verify the signatures using |
216 |
| -
|
217 |
| -[source,sh,subs=attributes,subs="+attributes"] |
218 |
| ----- |
219 |
| -gpg --import KEYS |
220 |
| -gpg --verify apache-log4j-{log4j-core-version}-bin.zip.asc |
221 |
| ----- |
222 |
| -
|
223 |
| -Alternatively, you can verify the SHA512 signature on the files. A unix |
224 |
| -program called sha512sum is included in many unix distributions. |
225 |
| -
|
226 |
| -[#requirements] |
227 |
| -== Requirements |
228 |
| -
|
229 |
| -The Apache Log4j runtime requires a minimum of Java 17. |
230 |
| -See the http://logging.apache.org/2.x[Log4j 2 website] for the latest releases supporting Java 6, 7, and 8. |
231 |
| -
|
232 |
| -== Previous Releases |
233 |
| -
|
234 |
| -All previous releases of Apache log4j can be found in the |
235 |
| -https://archive.apache.org/dist/logging/log4j/[ASF archive repository]. Of course, all releases are availble for |
236 |
| -use as dependencies from the https://search.maven.org/search?q=org.apache.logging.log4j[Maven Central Repository] |
237 |
| -
|
238 |
| -== Using Apache Log4j on your classpath |
239 |
| -
|
240 |
| -To use Log4j in your application make sure that the API, Plugins, and Core |
241 |
| -jars are in the application’s classpath. Add the dependencies listed |
242 |
| -below to your classpath. |
243 |
| -
|
244 |
| -* log4j-api-{log4j-api-version}.jar |
245 |
| -* log4j-plugins-{log4j-core-version}.jar |
246 |
| -* log4j-core-{log4j-core-version}.jar |
247 |
| -
|
248 |
| -You can do this from the command line or a manifest file. |
| 22 | +* Are you looking for **the Log4j installation instructions**? Proceed to xref:manual/installation.adoc[]. |
| 23 | +* Are you looking for the list of changes associated with a particular release? Proceed to xref:release-notes.adoc[]. |
0 commit comments