Log4j Docgen Maven Plugin

Log4j Docgen Maven Plugin allows you to easily run Log4j Docgen documentation generator and schema generator from your pom.xml.

Dependencies

You need to have the org.apache.logging.log4j:log4j-docgen-maven-plugin dependency in your classpath:

<plugin>
  <groupId>org.apache.logging.log4j</groupId>
  <artifactId>log4j-docgen-maven-plugin</artifactId>
  <version>0.9.0</version>
</plugin>

Generate documentation

The generate-documentation goal generates an AsciiDoc-formatted documentation using FreeMarker templates that are fed with the types loaded from given descriptors:

An example log4j-docgen:generate-documentation configuration
<configuration>

  <descriptorFileMatchers>
    <descriptorFileMatcher>
      <baseDirectory>${project.build.directory}/plugin-descriptors</baseDirectory>
    </descriptorFileMatcher>
  </descriptorFileMatchers>

  <typeFilter>
    <excludes>
      <exclude>^java\..+</exclude>
    </excludes>
  </typeFilter>

  <templateDirectory>${project.basedir}/src/docgen-templates</templateDirectory>

  <indexTemplates>
    <template>
      <source>index.adoc.ftl</source>
      <target>${project.build.directory}/generated-site/asciidoc/plugin-reference/index.adoc</target>
    </template>
  </indexTemplates>

  <typeTemplates>
    <template>
      <source>type.adoc.ftl</source>
      <target>${project.build.directory}/generated-site/asciidoc/plugin-reference/%g/%a/%c.adoc</target>(1)
    </template>
  </typeTemplates>

</configuration>

The generate-documentation goal configuration also accepts the following parameters:

skip (parameter)

Indicates if the execution should be skipped or not. It defaults to false and can be set using the log4j.docgen.skip property.

Generate schema

The generate-schema goal generates an XSD derived from the types loaded using given descriptors:

An example log4j-docgen:generate-schema configuration
<configuration>

  <descriptorFileMatchers>
    <descriptorFileMatcher>
      <baseDirectory>${project.build.directory}/plugin-descriptors</baseDirectory>
    </descriptorFileMatcher>
  </descriptorFileMatchers>

  <typeFilter>
    <excludes>
      <exclude>^java\..+</exclude>
    </excludes>
  </typeFilter>

  <schemaVersion>${project.version}</schemaVersion>
  <schemaFile>${project.build.directory}/generated-site/resources/config.xsd</schemaFile>

</configuration>

The generate-schema goal configuration also accepts the following parameters:

skip (parameter)

Indicates if the execution should be skipped or not. It defaults to false and can be set using the log4j.docgen.skip property.