Skip to content

Commit

Permalink
update logging documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
hboutemy committed Jun 19, 2023
1 parent bd71dd7 commit ec5e1ce
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 12 deletions.
19 changes: 7 additions & 12 deletions maven-embedder/src/site/apt/logging.apt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

Maven Logging

End-user logging documentation is available {{{/maven-logging.html}in Maven site}}.
{{{/maven-logging.html}End-user logging documentation}} is available {{{/maven-logging.html}in Maven site}}.
This documentation is focused on internal implementation details.

* Logging API
Expand All @@ -48,7 +48,7 @@ Maven Logging

* Logging Implementation

Maven 3.1.0 ships bundled with {{{http://www.slf4j.org/apidocs/org/slf4j/impl/SimpleLogger.html}SLF4J simple logger}},
Maven 3.1.0 ships bundled with {{{https://www.slf4j.org/api/org/slf4j/simple/SimpleLogger.html}SLF4J simple logger}} and since 3.5.0 {{{../maven-slf4j-provider/}Maven-customized <<<maven-slf4j-provider>>>}},
but is ready to use other logging implementations: SLF4J is responsible for loading the implementation, referred to as
{{{http://www.slf4j.org/manual.html#swapping}"SLF4J bindings"}}.

Expand All @@ -62,6 +62,8 @@ Maven Logging
{{{./apidocs/org/apache/maven/cli/logging/Slf4jConfigurationFactory.html}Slf4jConfigurationFactory}} /
{{{./apidocs/org/apache/maven/cli/logging/Slf4jConfiguration.html}Slf4jConfiguration}}.

~~ TODO document META-INF/maven/slf4j-configuration.properties

* Getting Logger Instance

Starting with Maven 3.1.0, SLF4J Logger can be used directly. This technique can be used safely in Maven core
Expand All @@ -79,14 +81,7 @@ public class MyClass

* Logger Name

Before Maven 3.1.0, with logging implementation done in Maven, logger name wasn't used by basic console logging implementation:
they are as-is, without clear convention on when to pass logger from class to class or when to create a new logger.

Starting with Maven 3.1.0, logging implementation can be of greatest use if logger names are well defined. This definition still
needs to be defined and implemented:

* classical "class name" pattern?

* Maven-specific name hierarchy?
Logger name is basically the classical fully qualified class name: it's not visible by default, but can be activated (see {{{/maven-logging.html}user documentation}}).

* a mix (some with class name, some with Maven-specific hierarchy)?
Notice that before Maven 3.1.0, with logger created by Maven, some code used to pass logger from class to class because it could not create a new logger:
discrepencies between logger name and actual class may happen.
35 changes: 35 additions & 0 deletions maven-slf4j-provider/src/site/apt/index.apt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
~~ 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.

-----
About
-----
Hervé Boutemy
-----
2023-06-19
-----

Maven SLF4J Provider

An extension to {{{https://www.slf4j.org/api/org/slf4j/simple/SimpleLogger.html}SLF4J Simple}} to add enhanced color support.

Color is managed by <<<MavenSimpleLogger>>>, created by <<<MavenSimpleLoggerFactory>>>, and injected by <<<StaticLoggerBinder>>>: everything else is
copied at build time from {{{https://www.slf4j.org/api/org/slf4j/simple/SimpleLogger.html}SLF4J Simple}}

* See Also

* {{{../maven-embedder/logging.html}Maven Logging}}

0 comments on commit ec5e1ce

Please sign in to comment.