Skip to content

Commit 99bb351

Browse files
committed
Fix broken links
1 parent 26a6242 commit 99bb351

File tree

8 files changed

+48
-22
lines changed

8 files changed

+48
-22
lines changed

log4j-core/src/main/java/org/apache/logging/log4j/core/layout/XmlLayout.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
import org.apache.logging.log4j.core.util.KeyValuePair;
3030

3131
/**
32-
* Appends a series of {@code event} elements as defined in the <a href="log4j.dtd">log4j.dtd</a>.
32+
* Appends a series of {@code event} elements as defined in the
33+
* <a href="https://raw.githubusercontent.com/apache/logging-log4j2/2.x/log4j-core/src/main/resources/Log4j-events.xsd">Log4j-events.xsd</a>.
3334
*
3435
* <h2>Complete well-formed XML vs. fragment XML</h2>
3536
* <p>

src/site/antora/modules/ROOT/pages/manual/eventlogging.adoc

+5-3
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,16 @@ This feature allows for easy integration with existing log management and monito
3838
3939
== Example Configuration
4040
41-
To configure Log4j to output logs in Syslog (RFC5424) format, one needs to use the link:../javadoc/log4j-core/org/apache/logging/log4j/core/layout/StructuredDataLayout.html[`StructuredDataLayout`] layout.
41+
To configure Log4j to output logs in Syslog (RFC5424) format, one needs to use the
42+
`xref:manual/layouts.adoc#RFC5424Layout[Rfc5424Layout]`
43+
layout.
4244
Developers can use the following configuration to log events to a local Syslog server:
4345
4446
[source, xml]
4547
----
4648
<Appenders>
47-
<Syslog name="Syslog" host="localhost" port="514"> <1>
48-
<StructuredDataLayout complete="true" /> <2>
49+
<Syslog name="Syslog" host="localhost" port="514"> <!--1-->
50+
<Rfc5424Layout/> <!--2-->
4951
</Syslog>
5052
</Appenders>
5153

src/site/antora/modules/ROOT/pages/manual/extending.adoc

+6-4
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,13 @@ Applications may change the LoggerContextFactory that will be used by
4747
4848
1. Create a binding to the logging implementation.
4949
.. Implement a new link:../javadoc/log4j-core/org/apache/logging/log4j/core/impl/Log4jContextFactory.html[`LoggerContextFactory`].
50-
.. Implement a class that extends link:../javadoc/log4j-core/org/apache/logging/spi/Provider.html[`org.apache.logging.spi.Provider`]
50+
.. Implement a class that extends
51+
link:../javadoc/log4j-api/org/apache/logging/spi/Provider.html[`org.apache.logging.spi.Provider`]
5152
with a no-arg constructor that calls super-class's constructor with the
5253
Priority, the API version(s), `LoggerContextFactory` class, and
53-
optionally, a link:../javadoc/log4j-core/org/apache/logging/log4j/spi/ThreadContextMap.html[`ThreadContextMap`] implementation class.
54+
optionally, a
55+
link:../javadoc/log4j-api/org/apache/logging/log4j/spi/ThreadContextMap.html[`ThreadContextMap`]
56+
implementation class.
5457
.. Create a `META-INF/services/org.apache.logging.spi.Provider` file
5558
that contains the name of the class that implements
5659
`org.apache.logging.spi.Provider`.
@@ -65,8 +68,7 @@ classpath.
6568
== ContextSelector
6669
6770
ContextSelectors are called by the
68-
link:../javadoc/log4j-core/org/apache/logging/log4j/core/impl/Log4jContextFactory.html[Log4j
69-
LoggerContext factory]. They perform the actual work of locating or
71+
link:../javadoc/log4j-core/org/apache/logging/log4j/core/impl/Log4jContextFactory.html[Log4j LoggerContext factory]. They perform the actual work of locating or
7072
creating a LoggerContext, which is the anchor for Loggers and their
7173
configuration. ContextSelectors are free to implement any mechanism they
7274
desire to manage LoggerContexts. The default Log4jContextFactory checks

src/site/antora/modules/ROOT/pages/manual/logbuilder.adoc

+11-6
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Next to the traditional `info()`, `error()`, etc. `Logger` methods, Log4j API al
5353
5454
Developers use Log4j traditionally with logging statements like:
5555
56-
[source, java]
56+
[source,java]
5757
----
5858
LOGGER.error("Unable to process request due to {}", errorCode, exception);
5959
----
@@ -66,13 +66,14 @@ This style has certain drawbacks:
6666
The fluent interface (also referred to as _the fluent API_) has been added to Log4j API to increase code legibility and avoid ambiguities.
6767
For instance, the above `error()` call can be expressed using the fluent API as follows:
6868
69-
[source, java]
69+
[source,java]
7070
----
7171
LOGGER
7272
.atError() // <1>
7373
.withThrowable(exception) // <2>
7474
.log("Unable to process request due to {}", errorCode); // <3>
7575
----
76+
7677
<1> The log level is set to `ERROR`
7778
<2> The associated exception is attached
7879
<3> The log message is formatted with the `errorCode` parameter
@@ -82,7 +83,9 @@ With this syntax, it is clear that the `exception` is part of the log event and
8283
[#usage]
8384
== Usage
8485
85-
The fluent API entry point is link:../log4j-api/apidocs/org/apache/logging/log4j/LogBuilder.html[`LogBuilder`], which can be obtained by using one of the following `Logger` methods:
86+
The fluent API entry point is
87+
link:../javadoc/log4j-api/org/apache/logging/log4j/LogBuilder.html[`LogBuilder`],
88+
which can be obtained by using one of the following `Logger` methods:
8689
8790
- `atTrace()`
8891
- `atDebug()`
@@ -97,20 +100,21 @@ The fluent API entry point is link:../log4j-api/apidocs/org/apache/logging/log4j
97100
98101
- `withMarker()`
99102
- `withThrowable()`
100-
- `withLocation()`
103+
- `withLocation()`
101104
102105
After that, developers can call the `log()` method to finalize and send the log event.
103106
104107
In the following example, we log a parameterized message at `INFO` level, and attach a marker and an exception to the log event:
105108
106-
[source, java]
109+
[source,java]
107110
----
108111
LOGGER
109112
.atInfo() // <1>
110113
.withMarker(marker) // <2>
111114
.withThrowable(exception) // <3>
112115
.log("Unable to process request due to {}", errorCode); // <4>
113116
----
117+
114118
<1> The log level is set to `INFO`
115119
<2> `marker` is attached to the log event
116120
<3> `exception` is attached to the log event
@@ -121,13 +125,14 @@ LOGGER
121125
122126
The fluent API allows users to instruct the location information to be *eagerly* populated in the log event using the `withLocation()` method:
123127
124-
[source, java]
128+
[source,java]
125129
----
126130
LOGGER
127131
.atInfo()
128132
.withLocation() // <1>
129133
.log("Login for user with ID `{}` failed", userId);
130134
----
135+
131136
<1> Instructing to eagerly populate the location information
132137
133138
Capturing location information using `withLocation()` is orders of magnitude more efficient compared to letting the `Logger` to figure it out indirectly.

src/site/antora/modules/ROOT/pages/manual/resource-logger.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
2020
== ScopedResourceLogger
2121
22-
The link:../log4j-api/apidocs/org/apache/logging/log4j/ScopedResourceLogger.html[`ScopedResourceLogger`]
22+
The link:../javadoc/log4j-api/org/apache/logging/log4j/ScopedResourceLogger.html[`ScopedResourceLogger`]
2323
is available in Log4j API releases 2.24.0 and greater.
2424
2525
A `ScopedResourceLogger` is a special kind of Logger that:

src/site/antora/modules/ROOT/pages/manual/thread-context.adoc

+15-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ Thread Context is one of many xref:manual/api.adoc#fish-tagging[_fish tagging_ c
2323
[#usage]
2424
== Usage
2525
26-
The entry point for associating logging-related information with the executing thread is link:../log4j-api/apidocs/org/apache/logging/log4j/ThreadContext.html[`ThreadContext`].
26+
The entry point for associating logging-related information with the executing thread is
27+
link:../javadoc/log4j-api/org/apache/logging/log4j/ThreadContext.html[`ThreadContext`].
2728
It offers both
2829
2930
* map-structured – referred to as _Thread Context Map_ or _Mapped Diagnostic Context (MDC)_
@@ -48,6 +49,7 @@ void performWork() {
4849
4950
ThreadContext.clear(); // <5>
5051
----
52+
5153
<1> Adding properties to the thread context map
5254
<2> Pushing properties to the thread context stack
5355
<3> Added properties can later on be used to, for instance, filter the log event, provide extra information in the layout, etc.
@@ -58,7 +60,11 @@ ThreadContext.clear(); // <5>
5860
=== Auto-clearing thread context
5961
6062
When placing items on the thread context stack or map, it's necessary to remove them again when appropriate.
61-
To assist with this, you can use link:../log4j-api/apidocs/org/apache/logging/log4j/CloseableThreadContext.html[`CloseableThreadContext`] (implementing http://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html[`AutoCloseable`]) in a try-with-resources block:
63+
To assist with this, you can use
64+
link:../javadoc/log4j-api/org/apache/logging/log4j/CloseableThreadContext.html[`CloseableThreadContext`]
65+
(implementing
66+
http://docs.oracle.com/javase/{java-target-version}/docs/api/java/lang/AutoCloseable.html[`AutoCloseable`])
67+
in a try-with-resources block:
6268
6369
[source,java]
6470
----
@@ -73,6 +79,7 @@ try (CloseableThreadContext.Instance ignored = CloseableThreadContext
7379
7480
// ... // <3>
7581
----
82+
7683
<1> Making thread context changes that will only be visible **within the scope of the try-with-resources block**
7784
<2> Added properties can later on be used to, for instance, filter the log event, provide extra information in the layout, etc.
7885
<3> Outside the scope of the try-with-resources block made thread context changes will not be visible
@@ -102,6 +109,7 @@ executor.submit(() -> {
102109
}
103110
});
104111
----
112+
105113
<1> Taking a snapshot of the thread context
106114
<2> Initializing the thread context for the background task
107115
@@ -136,8 +144,11 @@ META-INF/services/org.apache.logging.log4j.core.util.ContextDataProvider
136144
[#custom-ThreadContextMap]
137145
=== Custom thread context map
138146
139-
Custom thread context map implementations can be provided by setting xref:#log4j2.threadContextMap[the `log4j2.threadContextMap` system property] to the fully-qualified class name of the custom implementation class extending from link:../javadoc/log4j-core/org/apache/logging/log4j/spi/ThreadContextMap.html[`ThreadContextMap`].
147+
Custom thread context map implementations can be provided by setting xref:#log4j2.threadContextMap[the `log4j2.threadContextMap` system property] to the fully-qualified class name of the custom implementation class extending from
148+
link:../javadoc/log4j-api/org/apache/logging/log4j/spi/ThreadContextMap.html[`ThreadContextMap`].
140149
141-
While providing a custom thread context map implementation, you are advised to also extend from link:../javadoc/log4j-core/org/apache/logging/log4j/spi/ReadOnlyThreadContextMap.html[`ReadOnlyThreadContextMap`] too.
150+
While providing a custom thread context map implementation, you are advised to also extend from
151+
link:../javadoc/log4j-api/org/apache/logging/log4j/spi/ReadOnlyThreadContextMap.html[`ReadOnlyThreadContextMap`]
152+
too.
142153
By this way, your custom thread context map implementation will be accessible to applications via
143154
link:../javadoc/log4j-api/org/apache/logging/log4j/ThreadContext.html#getThreadContextMap()[`ThreadContext.getThreadContextMap()`].

src/site/antora/modules/ROOT/pages/manual/webapp.adoc

+2-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ For performance reasons, containers often ignore certain JARs known not to conta
6464
6565
==== The Long Story
6666
67-
The Log4j 2 Web JAR file is a web-fragment configured to order before any other web fragments in your application. It contains a `ServletContainerInitializer` (`Log4jServletContainerInitializer`) that the container automatically discovers and initializes. This adds the link:../javadoc/log4j-core/org/apache/logging/log4j/web/Log4jServletContextListener.html[Log4jServletContextListener] and `Log4jServletFilter` to the `ServletContext`. These classes properly initialize and deinitialize the Log4j configuration.
67+
The Log4j 2 Web JAR file is a web-fragment configured to order before any other web fragments in your application. It contains a `ServletContainerInitializer` (`Log4jServletContainerInitializer`) that the container automatically discovers and initializes. This adds the `Log4jServletContextListener` and `Log4jServletFilter` to the `ServletContext`. These classes properly initialize and deinitialize the Log4j configuration.
6868
6969
For some users, automatically starting Log4j is problematic or undesirable. You can easily disable this feature using the `isLog4jAutoInitializationDisabled` context parameter. Simply add it to your deployment descriptor with the value "true" to disable auto-initialization. You _must_ define the context parameter in `web.xml`. If you set in programmatically, it will be too late for Log4j to detect the setting.
7070
@@ -169,6 +169,7 @@ For security reasons, from Log4j 2.17.0, JNDI must be enabled by setting system
169169
You may want to use information about the web application during configuration. For example, you could embed the web application's context path in the name of a Rolling File Appender. See WebLookup in Lookups for more information.
170170
171171
=== JavaServer Pages Logging
172+
172173
You may use Log4j 2 within JSPs just as you would within any other Java code. Simply obtain a Logger and call its methods to log events. However, this requires you to use Java code within your JSPs, and some development teams rightly are not comfortable doing this. If you have a dedicated user interface development team that is not familiar with using Java, you may even have Java code disabled in your JSPs.
173174
174175
For this reason, Log4j 2 provides a JSP Tag Library that enables you to log events without using any Java code. To read more about using this tag library, xref:log4j-taglib.adoc[read the Log4j Tag Library documentation].

src/site/antora/modules/ROOT/partials/manual/systemproperties/properties-garbage-collection.adoc

+6-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ This prevents allocating temporary `String` and `char[]` instances.
3838
| Default value | `8192`
3939
|===
4040
41-
The size in bytes of the link:../https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html[ByteBuffer]s stored in `ThreadLocal` fields by layouts and
41+
The size in bytes of the
42+
https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html[ByteBuffer]s
43+
stored in `ThreadLocal` fields by layouts and
4244
link:../javadoc/log4j-core/org/apache/logging/log4j/core/layout/StringBuilderEncoder.html[StringBuilderEncoder]s.
4345
4446
This setting is only used if <<log4j2.enableDirectEncoders>> is set to `true`.
@@ -53,7 +55,9 @@ This setting is only used if <<log4j2.enableDirectEncoders>> is set to `true`.
5355
| Default value | `4096`
5456
|===
5557
56-
The size in ``char``s of the link:../https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html[ByteBuffer]s stored in `ThreadLocal` fields
58+
The size in ``char``s of the
59+
https://docs.oracle.com/javase/{java-target-version}/docs/api/java/nio/ByteBuffer.html[ByteBuffer]s
60+
stored in `ThreadLocal` fields
5761
link:../javadoc/log4j-core/org/apache/logging/log4j/core/layout/StringBuilderEncoder.html[StringBuilderEncoder]s.
5862
5963
This setting is only used if <<log4j2.enableDirectEncoders>> is set to `true`.

0 commit comments

Comments
 (0)