Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
ee07dc3
Revamp JTL page
vy Jun 2, 2024
439d206
Revamp JTL page
vy Jun 2, 2024
454c421
Move Pattern Layout to a separate page
vy Jun 4, 2024
f3879ab
Rewrite layouts in `layouts.adoc`
vy Jun 6, 2024
3150d81
Merge remote-tracking branch 'origin/2.x' into doc/2.x/layouts
vy Jun 6, 2024
631dbe4
Small adjustments
vy Jun 6, 2024
74a6ae4
Improve wording on UTF-8 default
vy Jun 10, 2024
f67176a
Improve wording
vy Jun 10, 2024
78330f0
Apply suggestions from code review
vy Jun 10, 2024
d651754
Merge remote-tracking branch 'origin/doc/2.x/layouts' into doc/2.x/la…
vy Jun 10, 2024
b95d668
Explain `PatternLayout` documentation notation
vy Jun 10, 2024
76f77b5
Remove incorrectly documented `%m{lookups}`
vy Jun 10, 2024
f77b5c0
Fix Pattern Layout gc-free lookups docs
vy Jun 10, 2024
c5f0126
Fix garbage-free notes about lookups for PL and JTL
vy Jun 10, 2024
0cf6c34
Add plugin ref links
vy Jun 10, 2024
f9deaaf
Move extending appenders/filters/lookups to their own pages
vy Jun 11, 2024
08d942b
Improve extending layouts
vy Jun 11, 2024
3c20113
Merge remote-tracking branch 'origin/2.x' into doc/2.x/extending
vy Jun 11, 2024
d495947
Rewrite `plugins.adoc`
vy Jun 12, 2024
65b9924
Merge remote-tracking branch 'origin/2.x' into doc/2.x/extending
vy Jun 13, 2024
fc1953b
Merge remote-tracking branch 'origin/2.x' into doc/2.x/extending
vy Jun 20, 2024
e5b8161
Revamp `extending.adoc`
vy Jun 21, 2024
34eb9f0
Rewrite architecture page and several other affected pages
vy Jun 25, 2024
df1813d
Merge remote-tracking branch 'origin/2.x' into doc/2.x/extending
vy Jun 25, 2024
defb250
Merge remote-tracking branch 'origin/2.x' into doc/2.x/extending
vy Jun 25, 2024
e4c028b
Replace Ditaa with PlantUML
vy Jun 25, 2024
4c7414c
Add information about reconfiguration
ppkarwasz Jun 26, 2024
71fbef6
Move `ConfigurationFactory` to `configuration.adoc`
vy Jun 26, 2024
dd7d8bc
Rewrite programmatic configuration
vy Jul 1, 2024
136506e
Merge remote-tracking branch 'origin/2.x' into doc/2.x/extending
vy Jul 1, 2024
f8a5534
Place `Reconfiguration reliability` under `Configuration`
vy Jul 1, 2024
0a09e70
Advise against programmatically modifying components
vy Jul 1, 2024
b690448
Fix Spotless failures
vy Jul 1, 2024
df9ee62
Remove incorrectly placed `Filters` section in `configuration.adoc`
vy Jul 1, 2024
e2a2168
Improve wording
vy Jul 1, 2024
def1d8f
Fix `ExampleConfigurationFactory` method overload
vy Jul 1, 2024
b950f88
Remove the mention of `type-safe`
vy Jul 1, 2024
cd56f42
Fix explanation on `Configurator.initialize()`
vy Jul 1, 2024
6399dbe
Fix explanation on `ConfigurationFactory` ordering
vy Jul 1, 2024
d1149f0
Fixing HTTP redirects based on fragments
vy Jul 1, 2024
c3e71b4
Fix `@Order` in `ExampleConfigurationFactory`
vy Jul 1, 2024
a44fe6c
Improve wording on `Usage#loadConfigurationFile()` example
vy Jul 2, 2024
43f84a7
Improve `LoggerContextFactory` explanations
vy Jul 2, 2024
8fd4b7e
Improve message factory documentation on placeholders
vy Jul 2, 2024
e505c16
Improve wording
vy Jul 2, 2024
242a7ed
Remove the mention of `elementType`
vy Jul 3, 2024
be4b992
Fix code typo
vy Jul 3, 2024
0b8c835
Explain which class loader is used
vy Jul 3, 2024
c06710f
Merge branch 'doc/2.x/extending' into doc/2.x/cloud
vy Jul 3, 2024
0739a60
Merge remote-tracking branch 'origin/2.x' into doc/2.x/cloud
vy Jul 3, 2024
e20572e
Revamp `cloud.adoc` for service-oriented architectures
vy Jul 5, 2024
01b1107
Merge remote-tracking branch 'origin/2.x' into doc/2.x/cloud
vy Jul 5, 2024
6e9cd9d
Fix Spotless failures
vy Jul 5, 2024
3b1d7fa
Fix Tomcat log file
vy Jul 7, 2024
f549b4f
Recommend setting protocol to TCP for `SocketAppender`
vy Jul 7, 2024
e03faec
Improved content on choosing a configuration file
vy Jul 7, 2024
fed8ac4
Apply review suggestion.
vy Jul 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/site/antora/antora.tmpl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ asciidoc:
project-id: "log4j"
java-target-version: "${maven.compiler.target}"
java-compiler-version: "${minimalJavaBuildVersion}"
log4j-kubernetes-url: "https://github.com/fabric8io/kubernetes-client/blob/main/doc/KubernetesLog4j.md"
logback-url: "https://logback.qos.ch"
logging-services-url: "https://logging.apache.org"
lmax-disruptor-url: "https://lmax-exchange.github.io/disruptor"
Expand Down
1 change: 1 addition & 0 deletions src/site/antora/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ asciidoc:
project-id: "log4j"
java-target-version: "8"
java-compiler-version: "[17,18)"
log4j-kubernetes-url: "https://github.com/fabric8io/kubernetes-client/blob/main/doc/KubernetesLog4j.md"
logback-url: "https://logback.qos.ch"
logging-services-url: "https://logging.apache.org"
lmax-disruptor-url: "https://lmax-exchange.github.io/disruptor"
Expand Down
24 changes: 24 additions & 0 deletions src/site/antora/modules/ROOT/examples/cloud/logstash/log4j2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"Configuration": {
"Appenders": {
// tag::socketAppender[]
"Socket": {
"name": "SOCKET",
"host": "localhost",
"port": 12345,
"JsonTemplateLayout": {
"nullEventDelimiterEnabled": true
}
}
// end::socketAppender[]
},
"Loggers": {
"Root": {
"level": "WARN",
"AppenderRef": {
"ref": "SOCKET"
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#
# 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.
#

# tag::socketAppender[]
appender.0.type = Socket
appender.0.name = SOCKET
appender.0.host = localhost
appender.0.port = 12345
appender.0.layout.type = JsonTemplateLayout
appender.0.layout.nullEventDelimiterEnabled = true
# end::socketAppender[]

rootLogger.level = WARN
rootLogger.appenderRef.0.ref = SOCKET
38 changes: 38 additions & 0 deletions src/site/antora/modules/ROOT/examples/cloud/logstash/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<Configuration xmlns="https://logging.apache.org/xml/ns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
https://logging.apache.org/xml/ns
https://logging.apache.org/xml/ns/log4j-config-2.xsd">

<Appenders>
<!-- tag::socketAppender[] -->
<Socket name="SOCKET" host="localhost" port="12345">
<JsonTemplateLayout nullEventDelimiterEnabled="true"/>
</Socket>
<!-- end::socketAppender[] -->
</Appenders>

<Loggers>
<Root level="WARN">
<AppenderRef ref="SOCKET"/>
</Root>
</Loggers>

</Configuration>
33 changes: 33 additions & 0 deletions src/site/antora/modules/ROOT/examples/cloud/logstash/log4j2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# 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.
#
Configuration:

Appenders:
# tag::socketAppender[]
Socket:
name: "SOCKET"
host: "localhost"
port: 12345
JsonTemplateLayout:
nullEventDelimiterEnabled: true
# end::socketAppender[]

Loggers:
Root:
level: "WARN"
AppenderRef:
ref: "SOCKET"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed src/site/antora/modules/ROOT/images/DockerStdout.png
Binary file not shown.
Binary file removed src/site/antora/modules/ROOT/images/DockerTCP.png
Binary file not shown.
Binary file not shown.
64 changes: 36 additions & 28 deletions src/site/antora/modules/ROOT/pages/log4j-docker.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,39 @@ Licensed to the Apache Software Foundation (ASF) under one or more
limitations under the License.
////

= Log4j Docker Support

Log4j supports Docker by providing a Lookup to retrieve container information.

== Accessing Docker

The Log4j Docker support requires access to the Docker REST interface.
In practical terms this means the application either needs access to unix:///var/run/docker.sock through a volume mount (not recommended), bind Docker to another host/port or unix socket.
or use a proxy application to provide access.
The https://github.com/apache/logging-log4j2/tree/main/log4j-spring-cloud-config/log4j-spring-cloud-config-samples/log4j-spring-cloud-config-sample-application[Log4j Spring Cloud sample application] uses a socat proxy to access Docker.

== Lookup Attributes

Log4j Docker provides access to the following container attributes:

* containerId - The full id assigned to the container.
* containerName - The name assigned to the container.
* imageId - The id assigned to the image.
* imageName - The name assigned to the image.
* shortContainerId - The first 12 characters of the container id.
* shortImageId - The first 12 characters of the image id.

Attributes may be accessed by adding `${docker:containerId}` to the configuration.
Note that docker variables are only resolved once during logging initialization so they shouldn't be referenced with more than one `$` character.

== Requirements

Log4j Docker requires Log4j Core, Log4j API and a minimum of Java 8.
= Log4j Docker

Log4j Docker module offers https://docker.com[Docker]-specific utilities.

[#install]
== Installation

You need to add the following additional runtime dependency to your build to use Log4j Docker:

[tabs]
====
Maven::
+
[source,xml,subs="+attributes"]
----
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-docker</artifactId>
<version>{log4j-core-version}</version>
<scope>runtime</scope>
</dependency>
----

Gradle::
+
[source,groovy,subs="+attributes"]
----
runtimeOnly 'org.apache.logging.log4j:log4j-docker:{log4j-core-version}'
----
====

[#features]
== Features

Log4j Docker provides xref:manual/lookups.adoc#DockerLookup[Docker Lookup] that queries https://docs.docker.com/engine/api/[the API of the Docker Engine] running your container.
You can use it to inject Docker-environment specific values (container ID, image name, etc.) in xref:manual/configuration.adoc#property-substitution[property substitutions].
Loading