vy commented on code in PR #2736:
URL: https://github.com/apache/logging-log4j2/pull/2736#discussion_r1675594018


##########
src/site/antora/modules/ROOT/pages/manual/lookups.adoc:
##########
@@ -16,63 +16,298 @@
 ////
 = Lookups
 
-Lookups provide a way to add values to the Log4j configuration at
-arbitrary places. They are a particular type of Plugin that implements
-the
-link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html[`StrLookup`]
-interface. Information on how to use Lookups in configuration files can
-be found in the xref:manual/configuration.adoc#PropertySubstitution[Property
-Substitution] section of the xref:manual/configuration.adoc[Configuration]
-page.
+Log4j Core provides a flexible and extensible property substitution system 
loosely based on the
+https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringSubstitutor.html[Commons
 Text `StringSubstitutor`].

Review Comment:
   Please remove this. This an internal detail that should be of interest to 
nobody.



##########
src/site/antora/modules/ROOT/pages/manual/lookups.adoc:
##########
@@ -16,63 +16,298 @@
 ////
 = Lookups
 
-Lookups provide a way to add values to the Log4j configuration at
-arbitrary places. They are a particular type of Plugin that implements
-the
-link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html[`StrLookup`]
-interface. Information on how to use Lookups in configuration files can
-be found in the xref:manual/configuration.adoc#PropertySubstitution[Property
-Substitution] section of the xref:manual/configuration.adoc[Configuration]
-page.
+Log4j Core provides a flexible and extensible property substitution system 
loosely based on the
+https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringSubstitutor.html[Commons
 Text `StringSubstitutor`].
+
+The property substitution system is composed of two kinds of elements:
+
+* A string interpolation engine 
(xref:manual/architecture.adoc#StrSubstitutor[`StrSubstitutor`]) that evaluates 
`$+{...}+` expressions.
+See xref:manual/configuration.adoc#property-substitution[property 
substitution] for more details.
+* A set of
+xref:plugin-reference.adoc#org-apache-logging-log4j_log4j-core_org-apache-logging-log4j-core-lookup-StrLookup[`StrLookup`]
+plugins that provide values for simple `$+{prefix:key}+` expressions.
+
+`StrLookup` is a simple map-like interface.
+The main difference between a map and `StrLookup` is
+that the latter can compute the value of a key programmatically in a global 
context or in the context of log event.
+
+[#evaluation-contexts]
+== Evaluation contexts
+
+Each lookup has an associated prefix,
+and Log4j can evaluate it in one of the following ways:
+
+[#global-context]
+Global context::
+In a global context Log4j evaluates `$+{prefix:key}+` expressions by calling
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(java.lang.String)[`lookup("key")`]
+on the lookup associated to `prefix`.
+The result of this call only takes into account the global state of the system.
++
+The global context is used to expand the attributes of a
+xref:manual/configuration.adoc[configuration file].
+
+[#event-context]
+Log event context::
+In the context of a log event `event`, Log4j evaluates `$+{prefix:key}+` 
expressions by calling
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(org.apache.logging.log4j.core.LogEvent,java.lang.String)[`lookup(event,
 "key")`] on the lookup associated to `prefix`.
+The result of this call might take into account the contents of the log event, 
besides the global state of the system.
+
+The xref:manual/pattern-layout.adoc#plugin-attr-pattern[`pattern`] attribute 
of `PatternLayout` is an example of attribute that supports both evaluation 
contexts:

Review Comment:
   The sentence sounds like `pattern` attribute is a special case. I tried to 
stress that it is just an example:
   
   ```suggestion
   Some configuration attributes (e.g., 
xref:manual/pattern-layout.adoc#plugin-attr-pattern[the `pattern` attribute of 
Pattern Layout]) supports both evaluation contexts:
   ```



##########
src/site/antora/modules/ROOT/pages/manual/lookups.adoc:
##########
@@ -16,63 +16,298 @@
 ////
 = Lookups
 
-Lookups provide a way to add values to the Log4j configuration at
-arbitrary places. They are a particular type of Plugin that implements
-the
-link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html[`StrLookup`]
-interface. Information on how to use Lookups in configuration files can
-be found in the xref:manual/configuration.adoc#PropertySubstitution[Property
-Substitution] section of the xref:manual/configuration.adoc[Configuration]
-page.
+Log4j Core provides a flexible and extensible property substitution system 
loosely based on the
+https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringSubstitutor.html[Commons
 Text `StringSubstitutor`].
+
+The property substitution system is composed of two kinds of elements:
+
+* A string interpolation engine 
(xref:manual/architecture.adoc#StrSubstitutor[`StrSubstitutor`]) that evaluates 
`$+{...}+` expressions.
+See xref:manual/configuration.adoc#property-substitution[property 
substitution] for more details.
+* A set of
+xref:plugin-reference.adoc#org-apache-logging-log4j_log4j-core_org-apache-logging-log4j-core-lookup-StrLookup[`StrLookup`]
+plugins that provide values for simple `$+{prefix:key}+` expressions.

Review Comment:
   I read these two bullets 3-4 times, I still don't understand the difference. 
I think a small diagram can help here. Borrow the one in `architecture.adoc`?



##########
src/site/antora/modules/ROOT/pages/manual/lookups.adoc:
##########
@@ -16,63 +16,298 @@
 ////
 = Lookups
 
-Lookups provide a way to add values to the Log4j configuration at
-arbitrary places. They are a particular type of Plugin that implements
-the
-link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html[`StrLookup`]
-interface. Information on how to use Lookups in configuration files can
-be found in the xref:manual/configuration.adoc#PropertySubstitution[Property
-Substitution] section of the xref:manual/configuration.adoc[Configuration]
-page.
+Log4j Core provides a flexible and extensible property substitution system 
loosely based on the
+https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringSubstitutor.html[Commons
 Text `StringSubstitutor`].
+
+The property substitution system is composed of two kinds of elements:
+
+* A string interpolation engine 
(xref:manual/architecture.adoc#StrSubstitutor[`StrSubstitutor`]) that evaluates 
`$+{...}+` expressions.
+See xref:manual/configuration.adoc#property-substitution[property 
substitution] for more details.
+* A set of
+xref:plugin-reference.adoc#org-apache-logging-log4j_log4j-core_org-apache-logging-log4j-core-lookup-StrLookup[`StrLookup`]
+plugins that provide values for simple `$+{prefix:key}+` expressions.
+
+`StrLookup` is a simple map-like interface.
+The main difference between a map and `StrLookup` is
+that the latter can compute the value of a key programmatically in a global 
context or in the context of log event.

Review Comment:
   ```suggestion
   The main difference between a map and `StrLookup` is that the latter can 
compute the value of a key dynamically in a global context or in the context of 
a log event.
   ```



##########
src/site/antora/modules/ROOT/pages/manual/lookups.adoc:
##########
@@ -16,63 +16,298 @@
 ////
 = Lookups
 
-Lookups provide a way to add values to the Log4j configuration at
-arbitrary places. They are a particular type of Plugin that implements
-the
-link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html[`StrLookup`]
-interface. Information on how to use Lookups in configuration files can
-be found in the xref:manual/configuration.adoc#PropertySubstitution[Property
-Substitution] section of the xref:manual/configuration.adoc[Configuration]
-page.
+Log4j Core provides a flexible and extensible property substitution system 
loosely based on the
+https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringSubstitutor.html[Commons
 Text `StringSubstitutor`].
+
+The property substitution system is composed of two kinds of elements:
+
+* A string interpolation engine 
(xref:manual/architecture.adoc#StrSubstitutor[`StrSubstitutor`]) that evaluates 
`$+{...}+` expressions.
+See xref:manual/configuration.adoc#property-substitution[property 
substitution] for more details.
+* A set of
+xref:plugin-reference.adoc#org-apache-logging-log4j_log4j-core_org-apache-logging-log4j-core-lookup-StrLookup[`StrLookup`]
+plugins that provide values for simple `$+{prefix:key}+` expressions.
+
+`StrLookup` is a simple map-like interface.
+The main difference between a map and `StrLookup` is
+that the latter can compute the value of a key programmatically in a global 
context or in the context of log event.
+
+[#evaluation-contexts]
+== Evaluation contexts
+
+Each lookup has an associated prefix,
+and Log4j can evaluate it in one of the following ways:
+
+[#global-context]
+Global context::
+In a global context Log4j evaluates `$+{prefix:key}+` expressions by calling
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(java.lang.String)[`lookup("key")`]
+on the lookup associated to `prefix`.
+The result of this call only takes into account the global state of the system.
++
+The global context is used to expand the attributes of a
+xref:manual/configuration.adoc[configuration file].
+
+[#event-context]
+Log event context::
+In the context of a log event `event`, Log4j evaluates `$+{prefix:key}+` 
expressions by calling
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(org.apache.logging.log4j.core.LogEvent,java.lang.String)[`lookup(event,
 "key")`] on the lookup associated to `prefix`.
+The result of this call might take into account the contents of the log event, 
besides the global state of the system.
+
+The xref:manual/pattern-layout.adoc#plugin-attr-pattern[`pattern`] attribute 
of `PatternLayout` is an example of attribute that supports both evaluation 
contexts:
+
+* During the configuration process the `$+{...}+` expressions are evaluated 
using a global context.
+* For each log event the `$$+{...}+` expressions are evaluated, using the log 
event as context.
+
+An example of lookup that can be used in both a global and event context is 
the `$+{date:...}+` lookup:

Review Comment:
   ```suggestion
   Lookups can choose to react differently depending on the execution context.
   <<DateLookup>> is such an example:
   ```



##########
src/site/antora/modules/ROOT/pages/manual/lookups.adoc:
##########
@@ -16,63 +16,298 @@
 ////
 = Lookups
 
-Lookups provide a way to add values to the Log4j configuration at
-arbitrary places. They are a particular type of Plugin that implements
-the
-link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html[`StrLookup`]
-interface. Information on how to use Lookups in configuration files can
-be found in the xref:manual/configuration.adoc#PropertySubstitution[Property
-Substitution] section of the xref:manual/configuration.adoc[Configuration]
-page.
+Log4j Core provides a flexible and extensible property substitution system 
loosely based on the
+https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringSubstitutor.html[Commons
 Text `StringSubstitutor`].
+
+The property substitution system is composed of two kinds of elements:
+
+* A string interpolation engine 
(xref:manual/architecture.adoc#StrSubstitutor[`StrSubstitutor`]) that evaluates 
`$+{...}+` expressions.
+See xref:manual/configuration.adoc#property-substitution[property 
substitution] for more details.
+* A set of
+xref:plugin-reference.adoc#org-apache-logging-log4j_log4j-core_org-apache-logging-log4j-core-lookup-StrLookup[`StrLookup`]
+plugins that provide values for simple `$+{prefix:key}+` expressions.
+
+`StrLookup` is a simple map-like interface.
+The main difference between a map and `StrLookup` is
+that the latter can compute the value of a key programmatically in a global 
context or in the context of log event.
+
+[#evaluation-contexts]
+== Evaluation contexts
+
+Each lookup has an associated prefix,
+and Log4j can evaluate it in one of the following ways:
+
+[#global-context]
+Global context::
+In a global context Log4j evaluates `$+{prefix:key}+` expressions by calling
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(java.lang.String)[`lookup("key")`]
+on the lookup associated to `prefix`.
+The result of this call only takes into account the global state of the system.
++
+The global context is used to expand the attributes of a
+xref:manual/configuration.adoc[configuration file].
+
+[#event-context]
+Log event context::
+In the context of a log event `event`, Log4j evaluates `$+{prefix:key}+` 
expressions by calling
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(org.apache.logging.log4j.core.LogEvent,java.lang.String)[`lookup(event,
 "key")`] on the lookup associated to `prefix`.
+The result of this call might take into account the contents of the log event, 
besides the global state of the system.
+
+The xref:manual/pattern-layout.adoc#plugin-attr-pattern[`pattern`] attribute 
of `PatternLayout` is an example of attribute that supports both evaluation 
contexts:
+
+* During the configuration process the `$+{...}+` expressions are evaluated 
using a global context.
+* For each log event the `$$+{...}+` expressions are evaluated, using the log 
event as context.
+
+An example of lookup that can be used in both a global and event context is 
the `$+{date:...}+` lookup:
+
+* When used in a global context, it formats the **current** timestamp obtained 
through
+https://docs.oracle.com/javase/{java-target-version}/docs/api/java/lang/System.html#currentTimeMillis--[`System.currentTimeMillis()`].
+* When used in the context of an event, it formats the **event** timestamp 
obtained through
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getTimeMillis()[`LogEvent.getTimeMillis()`].
+
+[#collection]
+== Collection
+
+Log4j Core provides many lookups out-of-the-box, which can be categorized into 
three non-disjoint groups:
+
+* A large group of lookups is available in a global context and provides 
results, which do not vary in time.
+These lookups can be safely used in eagerly evaluated properties of a
+xref:manual/configuration.adoc[configuration file]
+using the `${prefix:key}` syntax:
++
+[#global-context-immutable-list]
+.Immutable lookups available in the global context
+[cols="1,2m,5"]
+|===
+| Prefix | Dependency | Data source
 
-[#ContextMapLookup]
-== Context Map Lookup
+| <<ResourceBundleLookup,`bundle`>>
+|
+| A Java
+https://docs.oracle.com/javase/{java-target-version}/docs/api/java/util/ResourceBundle.html[resource
 bundle]
 
-The ContextMapLookup allows applications to store data in the Log4j
-ThreadContext Map and then retrieve the values in the Log4j
-configuration. In the example below, the application would store the
-current user's login id in the ThreadContext Map with the key "loginId".
-During initial configuration processing the first '$' will be removed.
-The PatternLayout supports interpolation with Lookups and will then
-resolve the variable for each event. Note that the pattern
-"%X\{loginId}" would achieve the same result.
+| <<DockerLookup,`docker`>>
+| log4j-docker
+| Docker container
+
+| <<EnvironmentLookup,`env`>>
+|
+| Environment variables
+
+| <<JavaLookup,`java`>>
+|
+| JVM characteristics
+
+| <<Log4jLookup,`log4j`>>
+|
+| Location of Log4j configuration file
+
+| <<MainMapLookup,`main`>>
+|
+| JVM application arguments
+
+| <<MarkerLookup,`marker`>>
+|
+| Returns `key` if a marker named `key` exists
+
+| <<SpringBootLookup,`spring`>>
+| log4j-spring-boot
+| Spring Boot 2.x environment.
+
+| <<SystemPropertiesLookup,`sys`>>
+|
+| Java system properties
+
+| <<WebLookup,`web`>>
+| log4j-jakarta-web
+| Jakarta
+https://jakarta.ee/specifications/servlet/6.0/apidocs/jakarta.servlet/jakarta/servlet/servletcontext[`ServletContext`].
+
+|===
+
+* A second group of lookups either gives results that vary in time or needs to 
be evaluated in the context of a log event.
+These lookups should be evaluated lazily using the `$$+{prefix:key}+` syntax.
+See
+xref:manual/configuration.adoc#lazy-property-substitution[lazy property 
substitution]
+for details.
++
+[#global-context-mutable-list]
+.Mutable lookups available in the global context
+[cols="1,2m,5"]
+|===
+| Prefix | Dependency | Data source
+
+| <<ContextMapLookup,`ctx`>>
+|
+| xref:manual/thread-context.adoc[]
+
+| <<DateLookup,`date`>>
+|
+| Current timestamp
+
+| <<JndiLookup,`jndi`>>
+|
+| JNDI
+
+|===
++
+[#event-context-list]
+.Lookups available in the context of a log event
+[cols="1,2m,5"]
+|===
+| Prefix | Dependency | Data source
+
+| <<ContextMapLookup,`ctx`>>
+|
+| Log event
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getContextData()[context
 data]
+
+| <<DateLookup,`date`>>
+|
+| Log event
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getTimeMillis()[timestamp]
+
+| <<EventLookup,`event`>>
+|
+| link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html[Log 
event]
+
+| <<MapLookup,`map`>>
+|
+| xref:manual/messages.adoc#MapMessage[`MapMessage`]
+
+| <<MarkerLookup,`marker`>>
+|
+| Log event
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getMarker()[marker]
+
+| <<StructuredDataLookup,`sd`>>
+|
+| xref:manual/messages.adoc#StructuredDataMessage[`StructuredDataMessage`]
+
+|===
+
+* Log4j Core also provides two lookups that can be used to modify the result 
of another lookup:
++
+[#helper-lookups-list]
+.Helper lookups
+[cols="1,2m,5"]
+|===
+| Prefix | Dependency | Description
+
+| <<LowerLookup,`lower`>>
+|
+| It converts the supplied key to lowercase
+
+| <<UpperLookup,`upper`>>
+|
+| It converts the supplied key to uppercase
+
+|===
+
+[#ResourceBundleLookup]
+=== Resource Bundle Lookup
+
+[cols="1h,4"]
+|===
+| Lookup ID | `bundle`
+
+| Context | _global_
+
+| Key format
+a| `<baseName> ":" <key>`
+
+where:
+
+`baseName`::
+the base name of a resource bundle (see
+https://docs.oracle.com/javase/8/docs/api/java/util/ResourceBundle.html[`ResourceBundle`])
+
+`key`::
+the key for the resource string
+|===
+
+The Resource Bundle lookup retrieves strings from Java Resource bundles, e.g.:

Review Comment:
   We had agreed to using `Resource Bundle Lookup`, `Date Lookup`, `Console 
Appender`, etc. while referring to a particular component. Would you update the 
document with this in mind, please?



##########
src/site/antora/modules/ROOT/pages/manual/lookups.adoc:
##########
@@ -89,561 +324,475 @@ It supports the retrieval of following container 
attributes:
 |shortImageId |The first 12 characters of the container image ID
 |===
 
-[id=environment-lookup]
-== [[EnvironmentLookup]] Environment Lookup
+Additional runtime dependencies are required for using Docker Lookup:
 
-The EnvironmentLookup allows systems to configure environment variables,
-either in global files such as /etc/profile or in the startup scripts
-for applications, and then retrieve those variables from within the
-logging configuration. The example below includes the name of the
-currently logged in user in the application log.
+include::partial$manual/dependencies-log4j-docker.adoc[]
 
-[source,xml]
-----
-<File name="Application" fileName="application.log">
-  <PatternLayout>
-    <pattern>%d %p %c{1.} [%t] $${env:USER} %m%n</pattern>
-  </PatternLayout>
-</File>
-----
+[#EnvironmentLookup]
+=== Environment Lookup
 
-This lookup also supports default value syntax. In the sample below,
-when the `USER` environment variable is undefined, the default value
-`jdoe` is used:
+[cols="1h,4"]
+|===
+| Lookup ID  | `env`
+| Context    | _global_
+| Key format | _any_ `String`
+|===
+
+The Environment Lookup retrieves the value of the
+https://docs.oracle.com/javase/{java-target-version}/docs/api/java/lang/System.html#getenv-java.lang.String-[OS
 environment variable]
+associated with the key.
 
-[source,xml]
-----
-<File name="Application" fileName="application.log">
-  <PatternLayout>
-    <pattern>%d %p %c{1.} [%t] $${env:USER:-jdoe} %m%n</pattern>
-  </PatternLayout>
-</File>
-----
 [#EventLookup]
-== Event Lookup
+=== Event Lookup

Review Comment:
   Shall we add a tip somewhere early in this section to stress that _"don't 
use this in layouts, because most of the time they have specialized 
instructions which are more feature rich and efficient. Such as..."_?
   
   Thinking about this more... I think this is such a frequently used bad 
practice, maybe we should also mention it in a dedicated section somewhere at 
the top explaining that you probably should not be using these in a layout.



##########
src/site/antora/modules/ROOT/pages/manual/lookups.adoc:
##########
@@ -89,561 +324,475 @@ It supports the retrieval of following container 
attributes:
 |shortImageId |The first 12 characters of the container image ID
 |===
 
-[id=environment-lookup]
-== [[EnvironmentLookup]] Environment Lookup
+Additional runtime dependencies are required for using Docker Lookup:
 
-The EnvironmentLookup allows systems to configure environment variables,
-either in global files such as /etc/profile or in the startup scripts
-for applications, and then retrieve those variables from within the
-logging configuration. The example below includes the name of the
-currently logged in user in the application log.
+include::partial$manual/dependencies-log4j-docker.adoc[]
 
-[source,xml]
-----
-<File name="Application" fileName="application.log">
-  <PatternLayout>
-    <pattern>%d %p %c{1.} [%t] $${env:USER} %m%n</pattern>
-  </PatternLayout>
-</File>
-----
+[#EnvironmentLookup]
+=== Environment Lookup
 
-This lookup also supports default value syntax. In the sample below,
-when the `USER` environment variable is undefined, the default value
-`jdoe` is used:
+[cols="1h,4"]
+|===
+| Lookup ID  | `env`
+| Context    | _global_
+| Key format | _any_ `String`
+|===
+
+The Environment Lookup retrieves the value of the
+https://docs.oracle.com/javase/{java-target-version}/docs/api/java/lang/System.html#getenv-java.lang.String-[OS
 environment variable]
+associated with the key.
 
-[source,xml]
-----
-<File name="Application" fileName="application.log">
-  <PatternLayout>
-    <pattern>%d %p %c{1.} [%t] $${env:USER:-jdoe} %m%n</pattern>
-  </PatternLayout>
-</File>
-----
 [#EventLookup]
-== Event Lookup
+=== Event Lookup
+
+[cols="1h,4"]
+|===
+| Lookup ID  | `event`
+| Context    | _log event_
+| Key format | _enumeration_
+|===
 
-The EventLookup provides access to fields within the log event from the 
configuration.
+The Event Lookup provides access to fields of the current log event.
+It supports the retrieval of the following event attributes:
 
 [cols="1m,4a"]
 |===
 |Key |Description
 
 |Exception
-|Returns the simple class name of the Exception, if one is included in the 
event.
+|Simple class name of the exception, if one is present.
 
 |Level
-|Returns the logging Level of the event.
+|xref:manual/customloglevels.adoc[Logging level] of the event
 
 |Logger
-|Returns the name of the Logger.
+|Name of the logger
 
 |Marker
-|Returns the name of the Marker associated with the log event, if one is 
present.
+|xref:manual/markers.adoc[Marker] associated with the log event, if one is 
present.
 
 |Message
-|Returns the formatted Message string.
+|Formatted xref:manual/messages.adoc[`Message`]
 
 |ThreadId
-|Returns the thread id associated with the log event.
+|Thread id associated with the log event
 
 |ThreadName
-|Returns the name of the thread associate with the log event.
+|Name of the thread associated with the log event
 
 |Timestamp
-|Returns the time in milliseconds when the event occurred.
-
+|UNIX timestamp in milliseconds of the log event
 |===
 
-In this example the RoutingAppender picks a route based on the presence of a 
Marker named "AUDIT" being
-present in the log event.
-[source,xml]
-----
-<?xml version="1.0" encoding="UTF-8"?>
-<Configuration status="WARN" name="RoutingTest">
-  <Appenders>
-    <Console name="STDOUT" target="SYSTEM_OUT" />
-    <Flume name="AuditLogger" compress="true">
-      <Agent host="192.168.10.101" port="8800"/>
-      <Agent host="192.168.10.102" port="8800"/>
-      <RFC5424Layout enterpriseNumber="18060" includeMDC="true" 
appName="MyApp"/>
-    </Flume>
-    <Routing name="Routing">
-      <Routes>
-        <Route pattern="$${event:Marker}">
-          <RollingFile
-              name="Rolling-${mdc:UserId}"
-              fileName="${mdc:UserId}.log"
-              filePattern="${mdc:UserId}.%i.log.gz">
-            <PatternLayout>
-              <pattern>%d %p %c{1.} [%t] %m%n</pattern>
-            </PatternLayout>
-            <SizeBasedTriggeringPolicy size="500" />
-          </RollingFile>
-        </Route>
-        <Route ref="AuditLogger" key="AUDIT"/>
-        <Route ref="STDOUT" key="STDOUT"/>
-      </Routes>
-      <IdlePurgePolicy timeToLive="15" timeUnit="minutes"/>
-    </Routing>
-  </Appenders>
-  <Loggers>
-    <Root level="error">
-      <AppenderRef ref="Routing" />
-    </Root>
-  </Loggers>
-</Configuration>
-----
-
 [#JavaLookup]
-== Java Lookup
+=== Java Lookup
+
+[cols="1h,4"]
+|===
+| Lookup ID  | `java`
+| Context    | _global_
+| Key format | _enumeration_
+|===
 
-The JavaLookup allows Java environment information to be retrieved in
-convenient preformatted strings using the `java:` prefix.
+The Java Lookup allows retrieving information about the Java environment the 
application is using.
+The following keys are supported
 
-[cols="1m,4a"]
+[cols="1m,2,6m"]
 |===
-|Key |Description
+|Key |Description |Example
 
 |version
-|The short Java version, like:
-
-`Java version 1.7.0_67`
+|Short Java version
+|Java version 21.0.3
 
 |runtime
-|The Java runtime version, like:
-
-`Java(TM) SE Runtime Environment (build 1.7.0_67-b01) from Oracle Corporation`
+|Java runtime version
+|OpenJDK Runtime Environment (build 21.0.3+9-LTS) from Eclipse Adoptium
 
 |vm
-|The Java VM version, like:
-
-`Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)`
+|Java VM version
+|OpenJDK 64-Bit Server VM (build 21.0.3+9-LTS, mixed mode, sharing)
 
 |os
-|The OS version, like:
-
-`Windows 7 6.1 Service Pack 1, architecture: amd64-64`
+|OS version
+|Linux 6.1.0-18-amd64, architecture: amd64-64
 
 |locale
-|Hardware information, like:
-
-`default locale: en_US, platform encoding: Cp1252`
+|System locale and file encoding
+|default locale: en_US, platform encoding: UTF-8
 
 |hw
-|System locale and file encoding information, like:
+|Hardware information
+|processors: 32, architecture: amd64-64, instruction sets: amd64`
+
+|===
 
-`processors: 4, architecture: amd64-64, instruction sets: amd64`
+[#JndiLookup]
+=== JNDI Lookup
 
+[cols="1h,4"]
 |===
+| Lookup ID  | `jndi`
+| Context    | _global_
 
-For example:
+| Key format
+| JNDI 
https://docs.oracle.com/javase/{java-target-version}/docs/api/javax/naming/Name.html[`Name`]
+|===
 
-[source,xml]
+[IMPORTANT]
+====
+As of Log4j `2.17.0` you need to enable the JNDI lookup **explicitly** by 
setting the
+xref:manual/systemproperties.adoc#log4j2.enableJndiLookup[`log4j2.enableJndiLookup`]
+configuration property to `true`.
+====
+
+The JNDI Lookup retrieves the value of an environment entry from JNDI.
+Only the `java:` protocol is supported.
+If the key does not have a protocol, `java:comp/env` is prepended.
+
+As an example, to retrieve the value of `java:comp/env/app_name` you can use:
+
+[source]
 ----
-<File name="Application" fileName="application.log">
-  <PatternLayout header="${java:runtime} - ${java:vm} - ${java:os}">
-    <Pattern>%d %m%n</Pattern>
-  </PatternLayout>
-</File>
+$${jndi:app_name}
 ----
 
-[#JndiLookup]
-== JNDI Lookup
+[NOTE]
+====
+Android does not support JNDI.
+====
 
-As of Log4j 2.15.1 JNDI operations require that `log4j2.enableJndi=true` be 
set as a system property or the
-corresponding environment variable for this lookup to function. See the
-xref:manual/systemproperties.adoc#log4j2.enableJndiLookup[`log4j2.enableJndiLookup`]
 system property.
+[#Log4jLookup]
+=== Configuration Location Lookup
+
+[cols="1h,4"]
+|===
+| Lookup ID  | `log4j`
+| Context    | _global_
+| Key format | _enumeration_
+|===
 
-The JndiLookup allows variables to be retrieved via JNDI. By default the
-key will be prefixed with java:comp/env/, however if the key contains a
-":" no prefix will be added.
+The Configuration Location Lookup supports two keys:
 
-By default the JNDI Lookup only supports the java, ldap, and ldaps protocols 
or no protocol. Additional
-protocols may be supported by specifying them on the 
``log4j2.allowedJndiProtocols`` property.
-When using LDAP Java classes that implement the Referenceable interface are 
not supported for security
-reasons. Only the Java primative classes are supported by default as well as 
any classes specified by the
-``log4j2.allowedLdapClasses`` property. When using LDAP only references to the 
local host name
-or ip address are supported along with any hosts or ip addresses listed in the
-``log4j2.allowedLdapHosts`` property.
+[cols="1m,4"]
+|===
+|Key |Description
 
-[source,xml]
-----
-<File name="Application" fileName="application.log">
-  <PatternLayout>
-    <pattern>%d %p %c{1.} [%t] $${jndi:logging/context-name} %m%n</pattern>
-  </PatternLayout>
-</File>
-----
+|configLocation
+|Returns the location of the configuration file as an absolute file path or 
URI.
 
-*Java's JNDI module is not available on Android.*
+|configParentLocation
+|Returns the location of the folder containing the configuration file as an 
absolute file path or URI.
+|===
 
-[#JmxRuntimeInputArgumentsLookup]
-== JVM Input Arguments Lookup (JMX)
+[#LowerLookup]
+=== Lower Lookup
 
-Maps JVM input arguments -- but not _main_ arguments -- using JMX to
-acquire the JVM arguments.
+[cols="1h,4"]
+|===
+| Lookup ID  | `lower`
+| Context    | _global_
+| Key format | _any_ `String`
+|===
 
-Use the prefix `jvmrunargs` to access JVM arguments.
+The Lower Lookup converts the passed in argument to lowercase.
 
-See the Javadocs for
-https://docs.oracle.com/javase/{java-target-version}/docs/api/java/lang/management/RuntimeMXBean.html#getInputArguments--[`java.lang.management.RuntimeMXBean.getInputArguments()`].
+Presumably, the value will be the result of a nested lookup as in the example:
 
-*Java's JMX module is not available on Android or on Google App Engine.*
+[source]
+----
+${lower:${sys:appname}}
+----
 
-[#KubernetesLookup]
-== Kubernetes Lookup
+[#MainMapLookup]
+=== Main Arguments Lookup
 
 [cols="1h,4"]
 |===
-|Lookup ID |`k8s`
-|Dependency |{log4j-kubernetes-url}[Log4j Kubernetes of Fabric8]
+| Lookup ID  | `main`
+| Context    | _global_
+| Key format | either an `int` or a `String`
 |===
 
-Kubernetes Lookup queries 
https://kubernetes.io/docs/concepts/overview/kubernetes-api/[the Kubernetes 
API] to retrieve certain information about the current container and its 
environment.
-Kubernetes Lookup is distributed as a part of Fabric8's Kubernetes Client, 
refer to {log4j-kubernetes-url}[its website] for details.
+[IMPORTANT]
+====
+This lookup requires a setup step:
+your application needs to call
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/MainMapLookup.html#setMainArguments(java.lang.String...)[`MainMapLookup#setMainArguments()`]
+and pass as argument the arguments received by the application.
+====
 
-[#Log4jConfigLookup]
-== Log4j Configuration Location Lookup
+The Main Arguments Lookup provides a way to query the arguments received by 
your application.
+It supports two kinds of keys:
 
-Log4j configuration properties. The expressions
-`${log4j:configLocation}` and `${log4j:configParentLocation}`
-respectively provide the absolute path to the log4j configuration file
-and its parent folder.
+* if the key is an integer, e.g. `${main:0}`, it is interpreted as 0-based 
index in the argument array.
+* if the key is a `String`, e.g. `${main:foo}`, the argument that follows 
`foo` in the argument array is returned.
+
+.Lookup results for "foo bar baz" arguments
+[cols="1m,1m"]
+|===
+| Lookup       | Expansion
+| ${main:0}   | foo
+| ${main:1}   | bar
+| ${main:2}   | baz
+| ${main:foo} | bar
+| ${main:bar} | baz
+|===
 
-The example below uses this lookup to place log files in a directory
-relative to the log4j configuration file.
+You can use this lookup to provide a primitive argument parsing mechanism to 
your application:
 
-[source,xml]
+* First, you need to pass your application's arguments to the 
`MainMapLookup#setMainArguments` method:
++
+[source,java,indent=0]
 ----
-<File name="Application" 
fileName="${log4j:configParentLocation}/logs/application.log">
-  <PatternLayout>
-    <pattern>%d %p %c{1.} [%t] %m%n</pattern>
-  </PatternLayout>
-</File>
+include::example$manual/lookups/MainArgsExample.java[tag=usage]
 ----
++
+<1> Use an **instance** logger field instead of a static one,
+to prevent Log4j Core initialization before `main()` is called.
+<2> Call `MainMapLookup#setMainArguments` by reflection to allow your 
application to run with a different Log4j API implementation.
 
-[#LowerLookup]
-== Lower Lookup
-
-The LowerLookup converts the passed in argument to lower case. Presumably the 
value will be the
-result of a nested lookup.
-
+* Now you can use `$+{main:...}+` lookups in your configuration file to 
support the usage of a `--logfile <file>` CLI argument to specify the log file 
and `--loglevel <level>` CLI argument to specify the log level.
++
+[tabs]
+====
+XML::
++
 [source,xml]
 ----
-<File name="Application" fileName="application.log">
-  <PatternLayout>
-    <pattern>%d %p %c{1.} [%t] $${lower:${spring:spring.application.name}} 
%m%n</pattern>
-  </PatternLayout>
-</File>
+include::example$manual/lookups/mainArgs.xml[lines=1;18..-1]
 ----
 
-[#AppMainArgsLookup]
-== Main Arguments Lookup (Application)
+JSON::
++
+[source,json]
+----
+include::example$manual/lookups/mainArgs.json[]
+----
 
-This lookup requires that you manually provide the main arguments of the
-application to Log4j:
+YAML::
++
+[source,yaml]
+----
+include::example$manual/lookups/mainArgs.yaml[lines=17..-1]
+----
 
-[source,java]
+Properties::
++
+[source,properties]
 ----
-import org.apache.logging.log4j.core.lookup.MainMapLookup;
-public class Main {
-    public static void main(String[] args) {
-      MainMapLookup.setMainArguments(args);
-      // ...
-    }
-}
+include::example$manual/lookups/mainArgs.properties[lines=18..-1]
 ----
+====
++
+<1> Provide default values for the CLI arguments if they are not specified.
+<2> Escape the special `:-` sequence using `:\-`.
 
-If the main arguments have been set, this lookup allows applications to
-retrieve these main argument values from within the logging
-configuration. The key that follows the `main:` prefix can either be a
-0-based index into the argument list, or a string, where
-`${main:myString}` is substituted with the value that follows `myString`
-in the main argument list.
+[#MapLookup]
+=== Map Lookup
 
-Note: Many applications use leading dashes to identify command arguments. 
Specifying
-`${main:--file}` would result in the lookup failing because it would look for 
a variable
-named "main" with a default value of "-file". To avoid this the ":" separating 
the Lookup name from the
-key must be followed by a backslash as an escape character as in 
`${main:\--file}`.
+[cols="1h,4"]
+|===
+| Lookup ID  | `map`
+| Context    | _log event_
+| Key format | _any_ `String`
+|===
 
-For example, suppose the static void main String[] arguments are:
+The Map Lookup retrieves the value assigned to the given key in a
+xref:manual/messages.adoc#MapMessage[`MapMessage`].
 
-....
---file foo.txt --verbose -x bar
-....
+[TIP]
+====
+Whenever conversion patterns are allowed, a `$$+{map:key}+` lookup is 
equivalent to a
+xref:manual/pattern-layout.adoc#converter-map[`%K\{key}` pattern].
+====
 
-Then the following substitutions are possible:
+[#MarkerLookup]
+=== Marker Lookup
 
-[cols="m,m"]
+[cols="1h,4"]
+|===
+| Lookup ID  | `marker`
+| Context    | _global_ or _log event_
+| Key format | _any_ `String`
 |===
-|Expression |Result
-
-|${main:0}
-|--file
 
-|${main:1}
-|foo.txt
+The Marker Lookup can be used in two different ways:
 
-|${main:2}
-|--verbose
+Global context::
+When used in a global context, it returns `key` if there is a marker named 
`key` or `null` otherwise.
+For example:
++
+----
+${marker:AUDIT:-NO_AUDIT}
+----
++
+will expand to `AUDIT` if a marker with that name exists or `NO_AUDIT` 
otherwise.
 
-|${main:3}
-|-x
+Log event context::
+When used in the context of a log event, it returns the
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html[log 
event marker] if it exists.
++
+[TIP]
+====
+Whenever conversion patterns are allowed, a `$$+{marker:}+` lookup is 
equivalent to a
+xref:manual/pattern-layout.adoc#converter-marker[`%markerSimpleName` pattern].
+====
 
-|${main:4}
-|bar
+[#SpringBootLookup]
+=== Spring Boot 2 Lookup
 
-|${main:\--file}
-|foo.txt
+[cols="1h,4"]
+|===
+| Lookup ID  | `spring`
+| Context    | _global_
+| Key format | _any_ `String`
+|===

Review Comment:
   ```suggestion
   | Dependency | xref:log4j-spring-boot.adoc[]
   |===
   ```
   
   (Yup, your aligned cells are ruined. Maybe that is why we should always 
avoid AsciiArt-aligning table cells?)



##########
src/site/antora/modules/ROOT/pages/manual/lookups.adoc:
##########
@@ -16,63 +16,298 @@
 ////
 = Lookups
 
-Lookups provide a way to add values to the Log4j configuration at
-arbitrary places. They are a particular type of Plugin that implements
-the
-link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html[`StrLookup`]
-interface. Information on how to use Lookups in configuration files can
-be found in the xref:manual/configuration.adoc#PropertySubstitution[Property
-Substitution] section of the xref:manual/configuration.adoc[Configuration]
-page.
+Log4j Core provides a flexible and extensible property substitution system 
loosely based on the
+https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringSubstitutor.html[Commons
 Text `StringSubstitutor`].
+
+The property substitution system is composed of two kinds of elements:
+
+* A string interpolation engine 
(xref:manual/architecture.adoc#StrSubstitutor[`StrSubstitutor`]) that evaluates 
`$+{...}+` expressions.
+See xref:manual/configuration.adoc#property-substitution[property 
substitution] for more details.
+* A set of
+xref:plugin-reference.adoc#org-apache-logging-log4j_log4j-core_org-apache-logging-log4j-core-lookup-StrLookup[`StrLookup`]
+plugins that provide values for simple `$+{prefix:key}+` expressions.
+
+`StrLookup` is a simple map-like interface.
+The main difference between a map and `StrLookup` is
+that the latter can compute the value of a key programmatically in a global 
context or in the context of log event.
+
+[#evaluation-contexts]
+== Evaluation contexts
+
+Each lookup has an associated prefix,
+and Log4j can evaluate it in one of the following ways:
+
+[#global-context]
+Global context::
+In a global context Log4j evaluates `$+{prefix:key}+` expressions by calling
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(java.lang.String)[`lookup("key")`]
+on the lookup associated to `prefix`.
+The result of this call only takes into account the global state of the system.
++
+The global context is used to expand the attributes of a
+xref:manual/configuration.adoc[configuration file].
+
+[#event-context]
+Log event context::
+In the context of a log event `event`, Log4j evaluates `$+{prefix:key}+` 
expressions by calling
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(org.apache.logging.log4j.core.LogEvent,java.lang.String)[`lookup(event,
 "key")`] on the lookup associated to `prefix`.
+The result of this call might take into account the contents of the log event, 
besides the global state of the system.
+
+The xref:manual/pattern-layout.adoc#plugin-attr-pattern[`pattern`] attribute 
of `PatternLayout` is an example of attribute that supports both evaluation 
contexts:
+
+* During the configuration process the `$+{...}+` expressions are evaluated 
using a global context.
+* For each log event the `$$+{...}+` expressions are evaluated, using the log 
event as context.
+
+An example of lookup that can be used in both a global and event context is 
the `$+{date:...}+` lookup:
+
+* When used in a global context, it formats the **current** timestamp obtained 
through
+https://docs.oracle.com/javase/{java-target-version}/docs/api/java/lang/System.html#currentTimeMillis--[`System.currentTimeMillis()`].
+* When used in the context of an event, it formats the **event** timestamp 
obtained through
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getTimeMillis()[`LogEvent.getTimeMillis()`].
+
+[#collection]
+== Collection
+
+Log4j Core provides many lookups out-of-the-box, which can be categorized into 
three non-disjoint groups:

Review Comment:
   `non-disjoint` contains double negation – practically no reader will 
understand it, nor they care.
   Whether the categories are overlapping or not doesn't change anything for 
the reader.
   
   ```suggestion
   Log4j Core provides many lookups out-of-the-box, which can be categorized as 
follows:
   ```



##########
src/site/antora/modules/ROOT/pages/manual/lookups.adoc:
##########
@@ -16,63 +16,298 @@
 ////
 = Lookups
 
-Lookups provide a way to add values to the Log4j configuration at
-arbitrary places. They are a particular type of Plugin that implements
-the
-link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html[`StrLookup`]
-interface. Information on how to use Lookups in configuration files can
-be found in the xref:manual/configuration.adoc#PropertySubstitution[Property
-Substitution] section of the xref:manual/configuration.adoc[Configuration]
-page.
+Log4j Core provides a flexible and extensible property substitution system 
loosely based on the
+https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringSubstitutor.html[Commons
 Text `StringSubstitutor`].
+
+The property substitution system is composed of two kinds of elements:
+
+* A string interpolation engine 
(xref:manual/architecture.adoc#StrSubstitutor[`StrSubstitutor`]) that evaluates 
`$+{...}+` expressions.
+See xref:manual/configuration.adoc#property-substitution[property 
substitution] for more details.
+* A set of
+xref:plugin-reference.adoc#org-apache-logging-log4j_log4j-core_org-apache-logging-log4j-core-lookup-StrLookup[`StrLookup`]
+plugins that provide values for simple `$+{prefix:key}+` expressions.
+
+`StrLookup` is a simple map-like interface.
+The main difference between a map and `StrLookup` is
+that the latter can compute the value of a key programmatically in a global 
context or in the context of log event.
+
+[#evaluation-contexts]
+== Evaluation contexts
+
+Each lookup has an associated prefix,
+and Log4j can evaluate it in one of the following ways:
+
+[#global-context]
+Global context::
+In a global context Log4j evaluates `$+{prefix:key}+` expressions by calling
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(java.lang.String)[`lookup("key")`]
+on the lookup associated to `prefix`.
+The result of this call only takes into account the global state of the system.
++
+The global context is used to expand the attributes of a
+xref:manual/configuration.adoc[configuration file].
+
+[#event-context]
+Log event context::
+In the context of a log event `event`, Log4j evaluates `$+{prefix:key}+` 
expressions by calling
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(org.apache.logging.log4j.core.LogEvent,java.lang.String)[`lookup(event,
 "key")`] on the lookup associated to `prefix`.
+The result of this call might take into account the contents of the log event, 
besides the global state of the system.
+
+The xref:manual/pattern-layout.adoc#plugin-attr-pattern[`pattern`] attribute 
of `PatternLayout` is an example of attribute that supports both evaluation 
contexts:
+
+* During the configuration process the `$+{...}+` expressions are evaluated 
using a global context.
+* For each log event the `$$+{...}+` expressions are evaluated, using the log 
event as context.
+
+An example of lookup that can be used in both a global and event context is 
the `$+{date:...}+` lookup:
+
+* When used in a global context, it formats the **current** timestamp obtained 
through
+https://docs.oracle.com/javase/{java-target-version}/docs/api/java/lang/System.html#currentTimeMillis--[`System.currentTimeMillis()`].
+* When used in the context of an event, it formats the **event** timestamp 
obtained through
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getTimeMillis()[`LogEvent.getTimeMillis()`].
+
+[#collection]
+== Collection
+
+Log4j Core provides many lookups out-of-the-box, which can be categorized into 
three non-disjoint groups:
+
+* A large group of lookups is available in a global context and provides 
results, which do not vary in time.
+These lookups can be safely used in eagerly evaluated properties of a
+xref:manual/configuration.adoc[configuration file]
+using the `${prefix:key}` syntax:
++
+[#global-context-immutable-list]
+.Immutable lookups available in the global context
+[cols="1,2m,5"]
+|===
+| Prefix | Dependency | Data source
 
-[#ContextMapLookup]
-== Context Map Lookup
+| <<ResourceBundleLookup,`bundle`>>
+|
+| A Java
+https://docs.oracle.com/javase/{java-target-version}/docs/api/java/util/ResourceBundle.html[resource
 bundle]
 
-The ContextMapLookup allows applications to store data in the Log4j
-ThreadContext Map and then retrieve the values in the Log4j
-configuration. In the example below, the application would store the
-current user's login id in the ThreadContext Map with the key "loginId".
-During initial configuration processing the first '$' will be removed.
-The PatternLayout supports interpolation with Lookups and will then
-resolve the variable for each event. Note that the pattern
-"%X\{loginId}" would achieve the same result.
+| <<DockerLookup,`docker`>>
+| log4j-docker
+| Docker container
+
+| <<EnvironmentLookup,`env`>>
+|
+| Environment variables
+
+| <<JavaLookup,`java`>>
+|
+| JVM characteristics
+
+| <<Log4jLookup,`log4j`>>
+|
+| Location of Log4j configuration file
+
+| <<MainMapLookup,`main`>>
+|
+| JVM application arguments
+
+| <<MarkerLookup,`marker`>>
+|
+| Returns `key` if a marker named `key` exists
+
+| <<SpringBootLookup,`spring`>>
+| log4j-spring-boot
+| Spring Boot 2.x environment.
+
+| <<SystemPropertiesLookup,`sys`>>
+|
+| Java system properties
+
+| <<WebLookup,`web`>>
+| log4j-jakarta-web
+| Jakarta
+https://jakarta.ee/specifications/servlet/6.0/apidocs/jakarta.servlet/jakarta/servlet/servletcontext[`ServletContext`].
+
+|===
+
+* A second group of lookups either gives results that vary in time or needs to 
be evaluated in the context of a log event.
+These lookups should be evaluated lazily using the `$$+{prefix:key}+` syntax.
+See
+xref:manual/configuration.adoc#lazy-property-substitution[lazy property 
substitution]
+for details.
++
+[#global-context-mutable-list]
+.Mutable lookups available in the global context
+[cols="1,2m,5"]
+|===
+| Prefix | Dependency | Data source
+
+| <<ContextMapLookup,`ctx`>>
+|
+| xref:manual/thread-context.adoc[]
+
+| <<DateLookup,`date`>>
+|
+| Current timestamp
+
+| <<JndiLookup,`jndi`>>
+|
+| JNDI
+
+|===
++
+[#event-context-list]
+.Lookups available in the context of a log event
+[cols="1,2m,5"]
+|===
+| Prefix | Dependency | Data source
+
+| <<ContextMapLookup,`ctx`>>
+|
+| Log event
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getContextData()[context
 data]
+
+| <<DateLookup,`date`>>
+|
+| Log event
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getTimeMillis()[timestamp]
+
+| <<EventLookup,`event`>>
+|
+| link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html[Log 
event]
+
+| <<MapLookup,`map`>>
+|
+| xref:manual/messages.adoc#MapMessage[`MapMessage`]
+
+| <<MarkerLookup,`marker`>>
+|
+| Log event
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getMarker()[marker]
+
+| <<StructuredDataLookup,`sd`>>
+|
+| xref:manual/messages.adoc#StructuredDataMessage[`StructuredDataMessage`]
+
+|===
+
+* Log4j Core also provides two lookups that can be used to modify the result 
of another lookup:
++
+[#helper-lookups-list]
+.Helper lookups
+[cols="1,2m,5"]
+|===
+| Prefix | Dependency | Description
+
+| <<LowerLookup,`lower`>>
+|
+| It converts the supplied key to lowercase
+
+| <<UpperLookup,`upper`>>
+|
+| It converts the supplied key to uppercase
+
+|===
+
+[#ResourceBundleLookup]
+=== Resource Bundle Lookup
+
+[cols="1h,4"]
+|===
+| Lookup ID | `bundle`
+
+| Context | _global_
+
+| Key format
+a| `<baseName> ":" <key>`
+
+where:
+
+`baseName`::
+the base name of a resource bundle (see
+https://docs.oracle.com/javase/8/docs/api/java/util/ResourceBundle.html[`ResourceBundle`])
+
+`key`::
+the key for the resource string
+|===
+
+The Resource Bundle lookup retrieves strings from Java Resource bundles, e.g.:
 
-[source,xml]
 ----
-<File name="Application" fileName="application.log">
-  <PatternLayout>
-    <pattern>%d %p %c{1.} [%t] $${ctx:loginId} %m%n</pattern>
-  </PatternLayout>
-</File>
+${bundle:org.example.Main:errorMessage}
 ----
 
+[#ContextMapLookup]
+=== Context Map Lookup
+
+[cols="1h,4"]
+|===
+| Lookup ID | `ctx`
+| Context | _global_ and _log event_
+| Key format | _any_ `String`
+|===
+
+The Context Map lookup can be used in two different contexts:
+
+Global context::
+If used in the global context, it uses the
+xref:manual/thread-context.adoc[]
+to retrieve data.
++
+[WARNING]
+====
+When used in this context
+xref:manual/thread-context.adoc#custom-ContextDataProvider[custom context data 
providers]
+are not supported.
+====
+
+Log event context::
+In the context of an event, the Context Map lookup uses the
+Log event
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getContextData()[context
 map data]
+of a log event to resolve the key.
+xref:manual/thread-context.adoc#custom-ContextDataProvider[Custom context data 
providers] are therefore supported.
++
+[TIP]
+====
+Whenever conversion patterns are allowed, a `$$+{ctx:key}+` lookup is 
equivalent to an
+xref:manual/pattern-layout.adoc#converter-thread-context-map[`%X\{key}` 
pattern].

Review Comment:
   `conversion pattern` is missing the context. And, IMHO, we should start with 
`Don't` to stress the bad practice.
   
   ```suggestion
   Don't use `$$+{ctx:key}+` in the xref:manual/pattern-layout.adoc[] 
conversion patterns!
   Use xref:manual/pattern-layout.adoc#converter-thread-context-map[the 
`%X\{key}` pattern converter] instead.
   ```
   
   Can you fix this in other occurrences of `conversion patterns` too, please?



##########
src/site/antora/modules/ROOT/pages/manual/lookups.adoc:
##########
@@ -16,63 +16,298 @@
 ////
 = Lookups
 
-Lookups provide a way to add values to the Log4j configuration at
-arbitrary places. They are a particular type of Plugin that implements
-the
-link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html[`StrLookup`]
-interface. Information on how to use Lookups in configuration files can
-be found in the xref:manual/configuration.adoc#PropertySubstitution[Property
-Substitution] section of the xref:manual/configuration.adoc[Configuration]
-page.
+Log4j Core provides a flexible and extensible property substitution system 
loosely based on the
+https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringSubstitutor.html[Commons
 Text `StringSubstitutor`].
+
+The property substitution system is composed of two kinds of elements:
+
+* A string interpolation engine 
(xref:manual/architecture.adoc#StrSubstitutor[`StrSubstitutor`]) that evaluates 
`$+{...}+` expressions.
+See xref:manual/configuration.adoc#property-substitution[property 
substitution] for more details.
+* A set of
+xref:plugin-reference.adoc#org-apache-logging-log4j_log4j-core_org-apache-logging-log4j-core-lookup-StrLookup[`StrLookup`]
+plugins that provide values for simple `$+{prefix:key}+` expressions.
+
+`StrLookup` is a simple map-like interface.
+The main difference between a map and `StrLookup` is
+that the latter can compute the value of a key programmatically in a global 
context or in the context of log event.
+
+[#evaluation-contexts]
+== Evaluation contexts
+
+Each lookup has an associated prefix,
+and Log4j can evaluate it in one of the following ways:
+
+[#global-context]
+Global context::
+In a global context Log4j evaluates `$+{prefix:key}+` expressions by calling
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(java.lang.String)[`lookup("key")`]
+on the lookup associated to `prefix`.
+The result of this call only takes into account the global state of the system.
++
+The global context is used to expand the attributes of a
+xref:manual/configuration.adoc[configuration file].
+
+[#event-context]
+Log event context::
+In the context of a log event `event`, Log4j evaluates `$+{prefix:key}+` 
expressions by calling
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(org.apache.logging.log4j.core.LogEvent,java.lang.String)[`lookup(event,
 "key")`] on the lookup associated to `prefix`.
+The result of this call might take into account the contents of the log event, 
besides the global state of the system.
+
+The xref:manual/pattern-layout.adoc#plugin-attr-pattern[`pattern`] attribute 
of `PatternLayout` is an example of attribute that supports both evaluation 
contexts:
+
+* During the configuration process the `$+{...}+` expressions are evaluated 
using a global context.
+* For each log event the `$$+{...}+` expressions are evaluated, using the log 
event as context.

Review Comment:
   ```suggestion
   * For each log event the `$$+{...}+` expressions (where `$$` is replaced 
with `$` during configuration process and this effectively passes `${...}` to 
the Pattern Layout) are evaluated, using the log event as context.
   ```



##########
src/site/antora/modules/ROOT/examples/manual/lookups/MainArgsExample.java:
##########
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+package example;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public final class MainArgsExample implements Runnable {
+
+    // tag::usage[]
+    private final Logger logger = LogManager.getLogger(); // <1>
+
+    public static void main(final String[] args) {
+        try { // <2>
+            Class.forName("org.apache.logging.log4j.core.lookup.MainMapLookup")
+                    .getDeclaredMethod("setMainArguments", String[].class)
+                    .invoke(null, (Object) args);
+        } catch (final ReflectiveOperationException e) {
+            // Log4j Core is not used.
+        }

Review Comment:
   Why don't we directly call `MainMapLookup.setMainArguments()`? I mean, if 
you use `setMainArguments()`, you do this to access it in the configuration, 
which implies you are already using Log4j Core. I am not able to see the point 
of indirection here. What am I missing? What is the use case addressed by this 
indirection?



##########
src/site/antora/modules/ROOT/pages/manual/lookups.adoc:
##########
@@ -16,63 +16,298 @@
 ////
 = Lookups
 
-Lookups provide a way to add values to the Log4j configuration at
-arbitrary places. They are a particular type of Plugin that implements
-the
-link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html[`StrLookup`]
-interface. Information on how to use Lookups in configuration files can
-be found in the xref:manual/configuration.adoc#PropertySubstitution[Property
-Substitution] section of the xref:manual/configuration.adoc[Configuration]
-page.
+Log4j Core provides a flexible and extensible property substitution system 
loosely based on the
+https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringSubstitutor.html[Commons
 Text `StringSubstitutor`].
+
+The property substitution system is composed of two kinds of elements:
+
+* A string interpolation engine 
(xref:manual/architecture.adoc#StrSubstitutor[`StrSubstitutor`]) that evaluates 
`$+{...}+` expressions.
+See xref:manual/configuration.adoc#property-substitution[property 
substitution] for more details.
+* A set of
+xref:plugin-reference.adoc#org-apache-logging-log4j_log4j-core_org-apache-logging-log4j-core-lookup-StrLookup[`StrLookup`]
+plugins that provide values for simple `$+{prefix:key}+` expressions.
+
+`StrLookup` is a simple map-like interface.
+The main difference between a map and `StrLookup` is
+that the latter can compute the value of a key programmatically in a global 
context or in the context of log event.
+
+[#evaluation-contexts]
+== Evaluation contexts
+
+Each lookup has an associated prefix,
+and Log4j can evaluate it in one of the following ways:
+
+[#global-context]
+Global context::
+In a global context Log4j evaluates `$+{prefix:key}+` expressions by calling
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(java.lang.String)[`lookup("key")`]
+on the lookup associated to `prefix`.
+The result of this call only takes into account the global state of the system.
++
+The global context is used to expand the attributes of a
+xref:manual/configuration.adoc[configuration file].
+
+[#event-context]
+Log event context::
+In the context of a log event `event`, Log4j evaluates `$+{prefix:key}+` 
expressions by calling
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(org.apache.logging.log4j.core.LogEvent,java.lang.String)[`lookup(event,
 "key")`] on the lookup associated to `prefix`.
+The result of this call might take into account the contents of the log event, 
besides the global state of the system.
+
+The xref:manual/pattern-layout.adoc#plugin-attr-pattern[`pattern`] attribute 
of `PatternLayout` is an example of attribute that supports both evaluation 
contexts:
+
+* During the configuration process the `$+{...}+` expressions are evaluated 
using a global context.
+* For each log event the `$$+{...}+` expressions are evaluated, using the log 
event as context.
+
+An example of lookup that can be used in both a global and event context is 
the `$+{date:...}+` lookup:
+
+* When used in a global context, it formats the **current** timestamp obtained 
through
+https://docs.oracle.com/javase/{java-target-version}/docs/api/java/lang/System.html#currentTimeMillis--[`System.currentTimeMillis()`].
+* When used in the context of an event, it formats the **event** timestamp 
obtained through
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getTimeMillis()[`LogEvent.getTimeMillis()`].
+
+[#collection]
+== Collection
+
+Log4j Core provides many lookups out-of-the-box, which can be categorized into 
three non-disjoint groups:
+
+* A large group of lookups is available in a global context and provides 
results, which do not vary in time.
+These lookups can be safely used in eagerly evaluated properties of a
+xref:manual/configuration.adoc[configuration file]
+using the `${prefix:key}` syntax:
++
+[#global-context-immutable-list]
+.Immutable lookups available in the global context
+[cols="1,2m,5"]
+|===
+| Prefix | Dependency | Data source
 
-[#ContextMapLookup]
-== Context Map Lookup
+| <<ResourceBundleLookup,`bundle`>>
+|
+| A Java
+https://docs.oracle.com/javase/{java-target-version}/docs/api/java/util/ResourceBundle.html[resource
 bundle]
 
-The ContextMapLookup allows applications to store data in the Log4j
-ThreadContext Map and then retrieve the values in the Log4j
-configuration. In the example below, the application would store the
-current user's login id in the ThreadContext Map with the key "loginId".
-During initial configuration processing the first '$' will be removed.
-The PatternLayout supports interpolation with Lookups and will then
-resolve the variable for each event. Note that the pattern
-"%X\{loginId}" would achieve the same result.
+| <<DockerLookup,`docker`>>
+| log4j-docker
+| Docker container
+
+| <<EnvironmentLookup,`env`>>
+|
+| Environment variables
+
+| <<JavaLookup,`java`>>
+|
+| JVM characteristics
+
+| <<Log4jLookup,`log4j`>>
+|
+| Location of Log4j configuration file
+
+| <<MainMapLookup,`main`>>
+|
+| JVM application arguments
+
+| <<MarkerLookup,`marker`>>
+|
+| Returns `key` if a marker named `key` exists
+
+| <<SpringBootLookup,`spring`>>
+| log4j-spring-boot
+| Spring Boot 2.x environment.
+
+| <<SystemPropertiesLookup,`sys`>>
+|
+| Java system properties
+
+| <<WebLookup,`web`>>
+| log4j-jakarta-web
+| Jakarta
+https://jakarta.ee/specifications/servlet/6.0/apidocs/jakarta.servlet/jakarta/servlet/servletcontext[`ServletContext`].
+
+|===
+
+* A second group of lookups either gives results that vary in time or needs to 
be evaluated in the context of a log event.
+These lookups should be evaluated lazily using the `$$+{prefix:key}+` syntax.
+See
+xref:manual/configuration.adoc#lazy-property-substitution[lazy property 
substitution]
+for details.
++
+[#global-context-mutable-list]
+.Mutable lookups available in the global context
+[cols="1,2m,5"]
+|===
+| Prefix | Dependency | Data source
+
+| <<ContextMapLookup,`ctx`>>
+|
+| xref:manual/thread-context.adoc[]
+
+| <<DateLookup,`date`>>
+|
+| Current timestamp
+
+| <<JndiLookup,`jndi`>>
+|
+| JNDI
+
+|===
++
+[#event-context-list]
+.Lookups available in the context of a log event
+[cols="1,2m,5"]
+|===
+| Prefix | Dependency | Data source
+
+| <<ContextMapLookup,`ctx`>>
+|
+| Log event
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getContextData()[context
 data]
+
+| <<DateLookup,`date`>>
+|
+| Log event
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getTimeMillis()[timestamp]
+
+| <<EventLookup,`event`>>
+|
+| link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html[Log 
event]
+
+| <<MapLookup,`map`>>
+|
+| xref:manual/messages.adoc#MapMessage[`MapMessage`]
+
+| <<MarkerLookup,`marker`>>
+|
+| Log event
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getMarker()[marker]
+
+| <<StructuredDataLookup,`sd`>>
+|
+| xref:manual/messages.adoc#StructuredDataMessage[`StructuredDataMessage`]
+
+|===
+
+* Log4j Core also provides two lookups that can be used to modify the result 
of another lookup:

Review Comment:
   Their `key` doesn't necessarily need to be a lookup.
   
   ```suggestion
   * Log4j Core also provides following auxiliary lookups:
   ```
   
   I think this is where my discomfort for the followed 3-way categorization 
has its peak. These two look out of place, but actually they are not. They seem 
like they are due to the grouping followed. You say for the 2nd group, not this 
one:
   
   > These lookups should be evaluated lazily using the `$${prefix:key}` syntax
   
   3rd group can also be evaluated lazily.
   
   Or you say `jndi` should be evaluated lazily. Why? I can use it to pass the 
username/password to an appender. There it is perfectly fine to use them 
eagerly.
   
   In conclusion, I liked the 2-way classification you had earlier: lookups 
supporting global context and log event context. I would rather present this in 
a matrix composed of columns `Lookup`, `Supports global context?`, and 
`Supports log event context?`.
   
   I think you're trying to educate people on when they should prefer `$$` over 
`$`. Maybe create a separate section for that with some concrete examples?



##########
src/site/antora/modules/ROOT/pages/manual/configuration.adoc:
##########
@@ -908,26 +908,44 @@ Therefore, the value of the `logging.file` property will 
be:
 =====
 
 [id=lazy-property-substitution]
-=== Lazy property substitution
+=== Runtime property substitution
 
-For most attributes, property substitution is performed only once at 
**configuration time**, but there are two categories of exceptions to this rule:
+For most attributes, property substitution is performed only once at 
**configuration time**,
+but there are exceptions to this rule: some attributes are **also** evaluated 
when a component-specific event occurs.
 
-* Some attributes are **also** evaluated when a component-specific event 
occurs.
-For example
-<<logger-elements-properties,additional context properties>>
-and the `pattern` attribute of the example below are evaluated at each log 
event, while the `filePattern` attribute of a
-xref:manual/appenders.adoc#rollingfileappender[rolling file appender]
-is evaluated at each rollover.
-+
 In this case:
 
-** If you want property substitution to happen only once, use one dollar sign, 
e.g., `${date:HH:mm:ss}`.
-** If you want property substitution to happen at each cyclic event, you use 
two dollar signs, e.g., `$${date:HH:mm:ss}`
+** If you want property substitution to happen at configuration time, use one 
dollar sign, e.g., `${date:HH:mm:ss}`.
+** If you want property substitution to happen at runtime, you use two dollar 
signs, e.g., `$${date:HH:mm:ss}`
 
-* Other components defer the evaluation of their child components.
-In this case, you only need one dollar `$` sign.
-+
-This case happens for the children of the `Route` element below:
+The list of attributes that support runtime property substitution is:
+
+* The `value` attribute of <<logger-elements-properties,nested `Property` 
elements>> of a logger configuration.
+* The
+xref:manual/pattern-layout.adoc#plugin-attr-pattern[`pattern`] attribute of 
the xref:manual/pattern-layout.adoc[].
+* Some values of a JSON template used by 
xref:manual/json-template-layout.adoc[].

Review Comment:
   ```suggestion
   * Event template attributes of xref:manual/json-template-layout.adoc[].
   ```



##########
src/site/antora/modules/ROOT/pages/manual/lookups.adoc:
##########
@@ -16,63 +16,298 @@
 ////
 = Lookups
 
-Lookups provide a way to add values to the Log4j configuration at
-arbitrary places. They are a particular type of Plugin that implements
-the
-link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html[`StrLookup`]
-interface. Information on how to use Lookups in configuration files can
-be found in the xref:manual/configuration.adoc#PropertySubstitution[Property
-Substitution] section of the xref:manual/configuration.adoc[Configuration]
-page.
+Log4j Core provides a flexible and extensible property substitution system 
loosely based on the
+https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/StringSubstitutor.html[Commons
 Text `StringSubstitutor`].
+
+The property substitution system is composed of two kinds of elements:
+
+* A string interpolation engine 
(xref:manual/architecture.adoc#StrSubstitutor[`StrSubstitutor`]) that evaluates 
`$+{...}+` expressions.
+See xref:manual/configuration.adoc#property-substitution[property 
substitution] for more details.
+* A set of
+xref:plugin-reference.adoc#org-apache-logging-log4j_log4j-core_org-apache-logging-log4j-core-lookup-StrLookup[`StrLookup`]
+plugins that provide values for simple `$+{prefix:key}+` expressions.
+
+`StrLookup` is a simple map-like interface.
+The main difference between a map and `StrLookup` is
+that the latter can compute the value of a key programmatically in a global 
context or in the context of log event.
+
+[#evaluation-contexts]
+== Evaluation contexts
+
+Each lookup has an associated prefix,
+and Log4j can evaluate it in one of the following ways:
+
+[#global-context]
+Global context::
+In a global context Log4j evaluates `$+{prefix:key}+` expressions by calling
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(java.lang.String)[`lookup("key")`]
+on the lookup associated to `prefix`.
+The result of this call only takes into account the global state of the system.
++
+The global context is used to expand the attributes of a
+xref:manual/configuration.adoc[configuration file].
+
+[#event-context]
+Log event context::
+In the context of a log event `event`, Log4j evaluates `$+{prefix:key}+` 
expressions by calling
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/lookup/StrLookup.html#lookup(org.apache.logging.log4j.core.LogEvent,java.lang.String)[`lookup(event,
 "key")`] on the lookup associated to `prefix`.
+The result of this call might take into account the contents of the log event, 
besides the global state of the system.
+
+The xref:manual/pattern-layout.adoc#plugin-attr-pattern[`pattern`] attribute 
of `PatternLayout` is an example of attribute that supports both evaluation 
contexts:
+
+* During the configuration process the `$+{...}+` expressions are evaluated 
using a global context.
+* For each log event the `$$+{...}+` expressions are evaluated, using the log 
event as context.
+
+An example of lookup that can be used in both a global and event context is 
the `$+{date:...}+` lookup:
+
+* When used in a global context, it formats the **current** timestamp obtained 
through
+https://docs.oracle.com/javase/{java-target-version}/docs/api/java/lang/System.html#currentTimeMillis--[`System.currentTimeMillis()`].
+* When used in the context of an event, it formats the **event** timestamp 
obtained through
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getTimeMillis()[`LogEvent.getTimeMillis()`].
+
+[#collection]
+== Collection
+
+Log4j Core provides many lookups out-of-the-box, which can be categorized into 
three non-disjoint groups:
+
+* A large group of lookups is available in a global context and provides 
results, which do not vary in time.
+These lookups can be safely used in eagerly evaluated properties of a
+xref:manual/configuration.adoc[configuration file]
+using the `${prefix:key}` syntax:
++
+[#global-context-immutable-list]
+.Immutable lookups available in the global context
+[cols="1,2m,5"]
+|===
+| Prefix | Dependency | Data source
 
-[#ContextMapLookup]
-== Context Map Lookup
+| <<ResourceBundleLookup,`bundle`>>
+|
+| A Java
+https://docs.oracle.com/javase/{java-target-version}/docs/api/java/util/ResourceBundle.html[resource
 bundle]
 
-The ContextMapLookup allows applications to store data in the Log4j
-ThreadContext Map and then retrieve the values in the Log4j
-configuration. In the example below, the application would store the
-current user's login id in the ThreadContext Map with the key "loginId".
-During initial configuration processing the first '$' will be removed.
-The PatternLayout supports interpolation with Lookups and will then
-resolve the variable for each event. Note that the pattern
-"%X\{loginId}" would achieve the same result.
+| <<DockerLookup,`docker`>>
+| log4j-docker
+| Docker container
+
+| <<EnvironmentLookup,`env`>>
+|
+| Environment variables
+
+| <<JavaLookup,`java`>>
+|
+| JVM characteristics
+
+| <<Log4jLookup,`log4j`>>
+|
+| Location of Log4j configuration file
+
+| <<MainMapLookup,`main`>>
+|
+| JVM application arguments
+
+| <<MarkerLookup,`marker`>>
+|
+| Returns `key` if a marker named `key` exists
+
+| <<SpringBootLookup,`spring`>>
+| log4j-spring-boot
+| Spring Boot 2.x environment.
+
+| <<SystemPropertiesLookup,`sys`>>
+|
+| Java system properties
+
+| <<WebLookup,`web`>>
+| log4j-jakarta-web
+| Jakarta
+https://jakarta.ee/specifications/servlet/6.0/apidocs/jakarta.servlet/jakarta/servlet/servletcontext[`ServletContext`].
+
+|===
+
+* A second group of lookups either gives results that vary in time or needs to 
be evaluated in the context of a log event.
+These lookups should be evaluated lazily using the `$$+{prefix:key}+` syntax.
+See
+xref:manual/configuration.adoc#lazy-property-substitution[lazy property 
substitution]
+for details.
++
+[#global-context-mutable-list]
+.Mutable lookups available in the global context
+[cols="1,2m,5"]
+|===
+| Prefix | Dependency | Data source
+
+| <<ContextMapLookup,`ctx`>>
+|
+| xref:manual/thread-context.adoc[]
+
+| <<DateLookup,`date`>>
+|
+| Current timestamp
+
+| <<JndiLookup,`jndi`>>
+|
+| JNDI
+
+|===
++
+[#event-context-list]
+.Lookups available in the context of a log event
+[cols="1,2m,5"]
+|===
+| Prefix | Dependency | Data source
+
+| <<ContextMapLookup,`ctx`>>
+|
+| Log event
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getContextData()[context
 data]
+
+| <<DateLookup,`date`>>
+|
+| Log event
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getTimeMillis()[timestamp]
+
+| <<EventLookup,`event`>>
+|
+| link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html[Log 
event]
+
+| <<MapLookup,`map`>>
+|
+| xref:manual/messages.adoc#MapMessage[`MapMessage`]
+
+| <<MarkerLookup,`marker`>>
+|
+| Log event
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getMarker()[marker]
+
+| <<StructuredDataLookup,`sd`>>
+|
+| xref:manual/messages.adoc#StructuredDataMessage[`StructuredDataMessage`]
+
+|===
+
+* Log4j Core also provides two lookups that can be used to modify the result 
of another lookup:
++
+[#helper-lookups-list]
+.Helper lookups
+[cols="1,2m,5"]
+|===
+| Prefix | Dependency | Description
+
+| <<LowerLookup,`lower`>>
+|
+| It converts the supplied key to lowercase
+
+| <<UpperLookup,`upper`>>
+|
+| It converts the supplied key to uppercase
+
+|===
+
+[#ResourceBundleLookup]
+=== Resource Bundle Lookup
+
+[cols="1h,4"]
+|===
+| Lookup ID | `bundle`
+
+| Context | _global_
+
+| Key format
+a| `<baseName> ":" <key>`
+
+where:
+
+`baseName`::
+the base name of a resource bundle (see
+https://docs.oracle.com/javase/8/docs/api/java/util/ResourceBundle.html[`ResourceBundle`])
+
+`key`::
+the key for the resource string
+|===
+
+The Resource Bundle lookup retrieves strings from Java Resource bundles, e.g.:
 
-[source,xml]
 ----
-<File name="Application" fileName="application.log">
-  <PatternLayout>
-    <pattern>%d %p %c{1.} [%t] $${ctx:loginId} %m%n</pattern>
-  </PatternLayout>
-</File>
+${bundle:org.example.Main:errorMessage}
 ----
 
+[#ContextMapLookup]
+=== Context Map Lookup
+
+[cols="1h,4"]
+|===
+| Lookup ID | `ctx`
+| Context | _global_ and _log event_
+| Key format | _any_ `String`
+|===
+
+The Context Map lookup can be used in two different contexts:
+
+Global context::
+If used in the global context, it uses the
+xref:manual/thread-context.adoc[]
+to retrieve data.
++
+[WARNING]
+====
+When used in this context
+xref:manual/thread-context.adoc#custom-ContextDataProvider[custom context data 
providers]
+are not supported.
+====
+
+Log event context::
+In the context of an event, the Context Map lookup uses the
+Log event
+link:../javadoc/log4j-core/org/apache/logging/log4j/core/LogEvent.html#getContextData()[context
 map data]
+of a log event to resolve the key.
+xref:manual/thread-context.adoc#custom-ContextDataProvider[Custom context data 
providers] are therefore supported.
++
+[TIP]
+====
+Whenever conversion patterns are allowed, a `$$+{ctx:key}+` lookup is 
equivalent to an
+xref:manual/pattern-layout.adoc#converter-thread-context-map[`%X\{key}` 
pattern].
+====
+
 [#DateLookup]
-== Date Lookup
+=== Date Lookup
 
-The DateLookup is somewhat unusual from the other lookups as it doesn't
-use the key to locate an item. Instead, the key can be used to specify a
-date format string that is valid for
-https://docs.oracle.com/javase/{java-target-version}/docs/api/java/text/SimpleDateFormat.html[`SimpleDateFormat`].
-The current date, or the date associated with the current log event will
-be formatted as specified.
+[cols="1h,4"]
+|===
+| Lookup ID | `date`
 
-[source,xml]
-----
-<RollingFile name="Rolling-${map:type}" fileName="${filename}" 
filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}.%i.log.gz">
-  <PatternLayout>
-    <pattern>%d %p %c{1.} [%t] %m%n</pattern>
-  </PatternLayout>
-  <SizeBasedTriggeringPolicy size="500" />
-</RollingFile>
-----
+| Context | _global_ and _log event_
+
+| Key format

Review Comment:
   We can combine `Lookup ID` and `Key format` into a single `Syntax` field. 
Just an idea. :bulb:



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to