getColumns() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String getFrame() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setFrame(final String frame) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String getGrid() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setGrid(final String grid) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/log4j-docgen/src/test/it/example/JavadocExample.java b/log4j-docgen/src/test/it/example/JavadocExample.java
new file mode 100644
index 00000000..80e8fd43
--- /dev/null
+++ b/log4j-docgen/src/test/it/example/JavadocExample.java
@@ -0,0 +1,128 @@
+/*
+ * 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;
+
+/**
+ * Example of JavaDoc to AsciiDoc conversion
+ *
+ * We run the {@code javadoc} tool on this class to test conversion of JavaDoc comments to AsciiDoc. This
+ * paragraph has two sentences.
+ *
+ *
+ * A sentence with foo
, foo`
, foo
bar. Another sentence with {@code foo},
+ * {@code foo`}, {@code foo}bar.
+ *
+ *
+ * We can use strong emphasis too, or we can use bold and italic.
+ *
+ *
+ * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum blandit dictum sem, ornare posuere lorem
+ * convallis sit amet. Sed dui augue, faucibus ut nisi id, mollis euismod nibh. Donec lobortis luctus viverra. In
+ * orci ante, pretium et fringilla at, sagittis nec justo. Cras finibus lorem vel volutpat interdum. Sed laoreet
+ * libero eros, ac cursus nibh dapibus vitae. Integer ante lorem, rhoncus at tortor vel, congue accumsan lorem.
+ * In hac habitasse platea dictumst. Nunc luctus ornare justo. Etiam ut metus id tortor dignissim semper. Nam
+ * turpis dui, aliquet nec enim et, faucibus accumsan dui.
+ *
+ *
+ * Aenean tincidunt elit id posuere mattis. Fusce bibendum sapien sed risus ultricies, non molestie erat volutpat.
+ * Donec nisi felis, egestas eu lobortis id, vulputate nec felis. In at dui euismod, blandit nulla et, accumsan
+ * elit. Proin id venenatis dui. Suspendisse sit amet est ut neque tincidunt venenatis. Donec bibendum quis velit
+ * fermentum porttitor. Maecenas faucibus, eros sit amet maximus malesuada, turpis neque bibendum justo, eu
+ * vehicula justo metus a ipsum. In at ullamcorper ipsum. Quisque in vehicula erat. Proin vitae suscipit dui,
+ * rutrum hendrerit augue. Curabitur finibus feugiat elit.
+ *
+ *
+ * - Item with a nested ordered list.
+ *
+ * - First nested item.
+ * - Second nested item.
+ *
+ *
+ * - Item with a nested unordered list.
+ *
+ * - Unordered list item.
+ *
+ *
+ * -
+ *
+ * Item with complex content
+ *
+ *
+ * Mauris suscipit velit nec ligula mattis, nec varius augue accumsan. Curabitur a dolor dui. Quisque
+ * congue facilisis est nec dignissim. Pellentesque egestas eleifend faucibus. Fusce imperdiet ligula a
+ * lectus fringilla varius. Sed malesuada porta vulputate. Sed vulputate purus nec nibh interdum
+ * convallis. Cras faucibus, dolor tempus lacinia vehicula, elit risus luctus libero, sed molestie nisi
+ * lorem sit amet enim. Integer vitae enim sagittis, malesuada lorem at, interdum tellus. Suspendisse
+ * potenti. Vestibulum ac nisi sit amet ex dictum suscipit. Nulla varius augue a velit tincidunt feugiat.
+ * Proin fringilla id leo ut dignissim. Vivamus eu tellus eget orci suscipit viverra. Donec sodales et
+ * arcu vel mollis.
+ *
+ *
+ * Praesent gravida auctor lectus quis interdum. Etiam semper mauris quis neque bibendum molestie.
+ * Maecenas a lacus nec risus pellentesque accumsan. Suspendisse dictum dui eleifend nibh facilisis, non
+ * consequat neque elementum. Donec scelerisque ultricies ipsum, pretium elementum ex pellentesque
+ * malesuada. Mauris egestas massa vitae sapien lobortis convallis. Donec feugiat, purus commodo
+ * consequat vehicula, dolor urna aliquam arcu, id rutrum quam tortor quis libero. Sed varius justo eget
+ * congue lacinia.
+ *
+ *
+ *
+ *
+ * - Item of an unordered list.
+ *
+ * First section
+ *
+ *
+ * Key |
+ * Value |
+ *
+ *
+ * A |
+ * 1 |
+ *
+ *
+ * B |
+ * 2 |
+ *
+ *
+ * Subsection
+ *
+ * public final class Main {
+ * private static final Logger logger = LogManager.getLogger();
+ *
+ * public static void sayHello() {
+ * logger.info("Hello world!");
+ * }
+ * }
+ *
+ * Minimal configuration example
+ *
+ * <Configuration>
+ * <Appenders>
+ * <Console name="CONSOLE">
+ * <PatternLayout/>
+ * </Console>
+ * </Appenders>
+ * <Loggers>
+ * <Root level="INFO">
+ * <AppenderRef ref="CONSOLE"/>
+ * </Root>
+ * </Loggers>
+ * </Configuration>
+ *
+ */
+public class JavadocExample {}
diff --git a/log4j-docgen/src/test/java/org/apache/logging/log4j/docgen/processor/AsciidocConverterTest.java b/log4j-docgen/src/test/java/org/apache/logging/log4j/docgen/processor/AsciidocConverterTest.java
new file mode 100644
index 00000000..7ca4f0c8
--- /dev/null
+++ b/log4j-docgen/src/test/java/org/apache/logging/log4j/docgen/processor/AsciidocConverterTest.java
@@ -0,0 +1,132 @@
+/*
+ * 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 org.apache.logging.log4j.docgen.processor;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.tools.Diagnostic;
+import javax.tools.DiagnosticCollector;
+import javax.tools.DocumentationTool;
+import javax.tools.DocumentationTool.DocumentationTask;
+import javax.tools.FileObject;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+import javax.tools.ToolProvider;
+import jdk.javadoc.doclet.Doclet;
+import jdk.javadoc.doclet.DocletEnvironment;
+import jdk.javadoc.doclet.Reporter;
+import org.junit.jupiter.api.Test;
+
+public class AsciidocConverterTest {
+
+ private static final Path LICENSE_PATH;
+
+ static {
+ try {
+ LICENSE_PATH = Paths.get(AsciidocConverterTest.class
+ .getResource("/templates/license.ftl")
+ .toURI());
+ } catch (final URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Test
+ void convertToAsciidoc() throws Exception {
+ final DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
+ final DiagnosticCollector ds = new DiagnosticCollector<>();
+ final StandardJavaFileManager fileManager = tool.getStandardFileManager(null, Locale.ROOT, UTF_8);
+
+ final Path basePath = Paths.get(System.getProperty("basedir", "."));
+ final Path sourcePath = basePath.resolve("src/test/it/example/JavadocExample.java");
+ final Iterable extends JavaFileObject> sources = fileManager.getJavaFileObjectsFromPaths(List.of(sourcePath));
+
+ final Path destPath = basePath.resolve("target/test-site");
+ Files.createDirectories(destPath);
+ fileManager.setLocationFromPaths(StandardLocation.CLASS_OUTPUT, Set.of(destPath));
+
+ final DocumentationTask task = tool.getTask(null, fileManager, ds, TestDoclet.class, null, sources);
+ task.call();
+
+ final List warnings = ds.getDiagnostics().stream()
+ .filter(d -> d.getKind() != Diagnostic.Kind.NOTE)
+ .map(d -> d.getMessage(Locale.ROOT))
+ .toList();
+ assertThat(warnings).isEmpty();
+ final Path expectedPath = Paths.get(AsciidocConverterTest.class
+ .getResource("/expected/processor/JavadocExample.adoc")
+ .toURI());
+ assertThat(destPath.resolve("processor/JavadocExample.adoc")).hasSameTextualContentAs(expectedPath, UTF_8);
+ }
+
+ public static class TestDoclet implements Doclet {
+
+ @Override
+ public void init(final Locale locale, final Reporter reporter) {}
+
+ @Override
+ public String getName() {
+ return "test";
+ }
+
+ @Override
+ public Set extends Option> getSupportedOptions() {
+ return Set.of();
+ }
+
+ @Override
+ public SourceVersion getSupportedSourceVersion() {
+ return SourceVersion.RELEASE_17;
+ }
+
+ @Override
+ public boolean run(final DocletEnvironment environment) {
+ final AsciidocConverter converter = new AsciidocConverter(environment.getDocTrees());
+ final JavaFileManager fileManager = environment.getJavaFileManager();
+ try {
+ for (final Element element : environment.getIncludedElements()) {
+ if ("JavadocExample".equals(element.getSimpleName().toString())) {
+ final FileObject output = fileManager.getFileForOutput(
+ StandardLocation.CLASS_OUTPUT, "processor", "JavadocExample.adoc", null);
+ final String asciiDoc = converter.toAsciiDoc(element);
+ try (final OutputStream os = output.openOutputStream()) {
+ Files.copy(LICENSE_PATH, os);
+ os.write(asciiDoc.getBytes(UTF_8));
+ }
+ }
+ }
+ } catch (final IOException e) {
+ throw new RuntimeException(e);
+ }
+ return true;
+ }
+ }
+}
diff --git a/log4j-docgen/src/test/resources/expected/processor/JavadocExample.adoc b/log4j-docgen/src/test/resources/expected/processor/JavadocExample.adoc
new file mode 100644
index 00000000..7eafa535
--- /dev/null
+++ b/log4j-docgen/src/test/resources/expected/processor/JavadocExample.adoc
@@ -0,0 +1,134 @@
+////
+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
+
+ https://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.
+////
+Example of JavaDoc to AsciiDoc conversion
+
+We run the `javadoc` tool on this class to test conversion of JavaDoc comments to AsciiDoc.
+This paragraph has two sentences.
+
+A sentence with `foo`, `++foo`++`, `foo` bar.
+Another sentence with `foo`, `++foo`++`, `foo` bar.
+
+We can use *strong* _emphasis_ too, or we can use *bold* and _italic_.
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+Vestibulum blandit dictum sem, ornare posuere lorem convallis sit amet.
+Sed dui augue, faucibus ut nisi id, mollis euismod nibh.
+Donec lobortis luctus viverra.
+In orci ante, pretium et fringilla at, sagittis nec justo.
+Cras finibus lorem vel volutpat interdum.
+Sed laoreet libero eros, ac cursus nibh dapibus vitae.
+Integer ante lorem, rhoncus at tortor vel, congue accumsan lorem.
+In hac habitasse platea dictumst.
+Nunc luctus ornare justo.
+Etiam ut metus id tortor dignissim semper.
+Nam turpis dui, aliquet nec enim et, faucibus accumsan dui.
+
+Aenean tincidunt elit id posuere mattis.
+Fusce bibendum sapien sed risus ultricies, non molestie erat volutpat.
+Donec nisi felis, egestas eu lobortis id, vulputate nec felis.
+In at dui euismod, blandit nulla et, accumsan elit.
+Proin id venenatis dui.
+Suspendisse sit amet est ut neque tincidunt venenatis.
+Donec bibendum quis velit fermentum porttitor.
+Maecenas faucibus, eros sit amet maximus malesuada, turpis neque bibendum justo, eu vehicula justo metus a ipsum.
+In at ullamcorper ipsum.
+Quisque in vehicula erat.
+Proin vitae suscipit dui, rutrum hendrerit augue.
+Curabitur finibus feugiat elit.
+
+. Item with a nested ordered list.
++
+.. First nested item.
+.. Second nested item.
+. Item with a nested unordered list.
++
+* Unordered list item.
+. Item with complex content
++
+Mauris suscipit velit nec ligula mattis, nec varius augue accumsan.
+Curabitur a dolor dui.
+Quisque congue facilisis est nec dignissim.
+Pellentesque egestas eleifend faucibus.
+Fusce imperdiet ligula a lectus fringilla varius.
+Sed malesuada porta vulputate.
+Sed vulputate purus nec nibh interdum convallis.
+Cras faucibus, dolor tempus lacinia vehicula, elit risus luctus libero, sed molestie nisi lorem sit amet enim.
+Integer vitae enim sagittis, malesuada lorem at, interdum tellus.
+Suspendisse potenti.
+Vestibulum ac nisi sit amet ex dictum suscipit.
+Nulla varius augue a velit tincidunt feugiat.
+Proin fringilla id leo ut dignissim.
+Vivamus eu tellus eget orci suscipit viverra.
+Donec sodales et arcu vel mollis.
++
+Praesent gravida auctor lectus quis interdum.
+Etiam semper mauris quis neque bibendum molestie.
+Maecenas a lacus nec risus pellentesque accumsan.
+Suspendisse dictum dui eleifend nibh facilisis, non consequat neque elementum.
+Donec scelerisque ultricies ipsum, pretium elementum ex pellentesque malesuada.
+Mauris egestas massa vitae sapien lobortis convallis.
+Donec feugiat, purus commodo consequat vehicula, dolor urna aliquam arcu, id rutrum quam tortor quis libero.
+Sed varius justo eget congue lacinia.
+
+* Item of an unordered list.
+
+== First section
+
+[cols="1,1"]
+|===
+
+h| Key
+h| Value
+
+| A
+| 1
+
+| B
+| 2
+
+|===
+
+=== Subsection
+
+[source,java]
+----
+public final class Main {
+ private static final Logger logger = LogManager.getLogger();
+
+ public static void sayHello() {
+ logger.info("Hello world!");
+ }
+}
+----
+
+== Minimal configuration example
+
+[source,xml]
+----
+
+
+
+
+
+
+
+
+
+
+
+
+----
diff --git a/log4j-tools-parent/pom.xml b/log4j-tools-parent/pom.xml
index c9e0cdea..dff618b3 100644
--- a/log4j-tools-parent/pom.xml
+++ b/log4j-tools-parent/pom.xml
@@ -34,9 +34,11 @@
3.25.3
2.15.1
+ 3.14.0
2.3.32
1.0.5
5.10.2
+ 3.0.0-beta1
2.1.2
2.9.1
@@ -51,6 +53,14 @@
+
+ org.apache.logging.log4j
+ log4j-bom
+ ${log4j-bom.version}
+ pom
+ import
+
+
org.junit
junit-bom
@@ -71,6 +81,12 @@
${commons-io.version}
+
+ org.apache.commons
+ commons-lang3
+ ${commons-lang3.version}
+
+
org.freemarker
freemarker