Skip to content

Commit a65b7d6

Browse files
Remove jvmrunargs lookup and update changelog (fixes #2726)
1 parent de8c6c9 commit a65b7d6

File tree

4 files changed

+7
-111
lines changed

4 files changed

+7
-111
lines changed

log4j-core-test/src/test/java/org/apache/logging/log4j/core/lookup/JvmRunArgsIntegrationTest.java

Lines changed: 0 additions & 29 deletions
This file was deleted.

log4j-core-test/src/test/java/org/apache/logging/log4j/core/lookup/JvmRunArgsLookupTest.java

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<change>
3+
<summary>Removed the jvmrunargs lookup due to lack of clear use case and potential for confusion. See issue #2726 for details.</summary>
4+
<issue>2726</issue>
5+
<author>ramanathan1504</author>
6+
<date>2025-08-14</date>
7+
</change>

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

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,41 +1052,3 @@ You can check out the following files for examples:
10521052
10531053
* {project-github-url}/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/LowerLookup.java[`LowerLookup.java`] – <<LowerLookup>> lower-cases its input
10541054
* {project-github-url}/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/EventLookup.java[`EventLookup.java`] – <<EventLookup>> extracts specified fields from the effective `LogEvent` in the context
1055-
1056-
[[JVMRunArgsLookup]]
1057-
== JVM Runtime Arguments Lookup
1058-
1059-
The `jvmrunargs` lookup allows retrieval of the JVM runtime arguments
1060-
passed to the Java process at startup.
1061-
1062-
=== Usage
1063-
1064-
Use the `${jvmrunargs:<index>}` syntax, where `<index>` is the zero-based
1065-
position of the JVM argument to retrieve.
1066-
1067-
For example:
1068-
1069-
[source,xml]
1070-
----
1071-
<Appenders>
1072-
<Console name="Console" target="SYSTEM_OUT">
1073-
<PatternLayout pattern="JVM Arg[0]: ${jvmrunargs:0} %m%n" />
1074-
</Console>
1075-
</Appenders>
1076-
----
1077-
1078-
If the specified index is out of range, the lookup returns `null`.
1079-
1080-
=== Example Output
1081-
1082-
Given the following JVM startup arguments:
1083-
1084-
The lookup expressions would produce:
1085-
1086-
- `${jvmrunargs:0}` → `-DexampleArg=value`
1087-
- `${jvmrunargs:1}` → `-Xmx512m`
1088-
1089-
=== Notes
1090-
1091-
* This lookup was fixed in version 2.25.0.
1092-
* If no JVM arguments are available, all lookups will return `null`.

0 commit comments

Comments
 (0)