diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jLogger.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jLogger.java index e231b53255..a2b9bca5be 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jLogger.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jLogger.java @@ -22,7 +22,8 @@ package org.apache.maven.cli.logging; import org.codehaus.plexus.logging.Logger; /** - * Adapt an SLF4J logger to a Plexus logger. + * Adapt an SLF4J logger to a Plexus logger, ignoring Plexus logger API parts that are not classical and + * probably not really used. * * @author Jason van Zyl */ @@ -112,15 +113,24 @@ public class Slf4jLogger return logger.isErrorEnabled(); } + /** + * Warning: ignored (always return 0). + */ public int getThreshold() { return 0; } + /** + * Warning: ignored. + */ public void setThreshold( int threshold ) { } + /** + * Warning: ignored (always return 0). + */ public Logger getChildLogger( String name ) { return null; diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jLoggerManager.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jLoggerManager.java index 0197f5c730..f30ea8f68e 100644 --- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jLoggerManager.java +++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/Slf4jLoggerManager.java @@ -25,7 +25,8 @@ import org.slf4j.ILoggerFactory; import org.slf4j.LoggerFactory; /** - * Use an SLF4J {@link org.slf4j.ILoggerFactory} as a backing for a Plexus {@link org.codehaus.plexus.logging.LoggerManager}. + * Use an SLF4J {@link org.slf4j.ILoggerFactory} as a backing for a Plexus {@link org.codehaus.plexus.logging.LoggerManager}, + * ignoring Plexus logger API parts that are not classical and probably not really used. * * @author Jason van Zyl * @since 3.1 @@ -46,37 +47,61 @@ public class Slf4jLoggerManager return new Slf4jLogger( loggerFactory.getLogger( role ) ); } + /** + * The logger name for a component with a non-null hint is role.hint. + * Warning: this does not conform to logger name as class name convention. + * (and what about null and default hint equivalence?) + */ public Logger getLoggerForComponent( String role, String hint ) { return ( null == hint ? getLoggerForComponent( role ) - : new Slf4jLogger( loggerFactory.getLogger( role + "." + hint ) ) ); + : new Slf4jLogger( loggerFactory.getLogger( role + '.' + hint ) ) ); } // // Trying to give loggers back is a bad idea. Ceki said so :-) + // notice to self: what was this method supposed to do? // + /** + * Warning: ignored. + */ public void returnComponentLogger( String role ) { } + /** + * Warning: ignored. + */ public void returnComponentLogger( String role, String hint ) { } + /** + * Warning: ignored (always return 0). + */ public int getThreshold() { return 0; } + /** + * Warning: ignored. + */ public void setThreshold( int threshold ) { } + /** + * Warning: ignored. + */ public void setThresholds( int threshold ) { } + /** + * Warning: ignored (always return 0). + */ public int getActiveLoggerCount() { return 0; diff --git a/maven-embedder/src/site/apt/logging.apt b/maven-embedder/src/site/apt/logging.apt index 2caf177579..cca01bf974 100644 --- a/maven-embedder/src/site/apt/logging.apt +++ b/maven-embedder/src/site/apt/logging.apt @@ -50,3 +50,16 @@ public class Wombat final Logger logger = LoggerFactory.getLogger(Wombat.class); } +----- + +* Logger Name + + Before Maven 3.1.0, with logging implementation done in Maven, logger name wasn't used: they are as-is, without clear definition. + + 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? + + * a mix (some with class name, some with Maven-specific hierarchy)?