Use consistent static final loggers

This commit is contained in:
Michael Osipov 2021-01-01 14:10:01 +01:00
parent 2201698234
commit a6d5e86155
4 changed files with 20 additions and 20 deletions

View File

@ -50,7 +50,7 @@ import java.util.function.Predicate;
@Singleton
public class MultiModuleCollectionStrategy implements ProjectCollectionStrategy
{
private final Logger logger = LoggerFactory.getLogger( getClass() );
private static final Logger LOGGER = LoggerFactory.getLogger( MultiModuleCollectionStrategy.class );
private final ModelLocator modelLocator;
private final ProjectsSelector projectsSelector;
@ -76,7 +76,7 @@ public class MultiModuleCollectionStrategy implements ProjectCollectionStrategy
}
else
{
logger.debug( "Multi module project collection failed:{}"
LOGGER.debug( "Multi module project collection failed:{}"
+ "Detected a POM file next to a .mvn folder in a parent directory ({}). "
+ "Maven assumed that POM file to be the parent of the requested project ({}), but it turned "
+ "out that it was not. Another project collection strategy will be executed as result.",
@ -91,7 +91,7 @@ public class MultiModuleCollectionStrategy implements ProjectCollectionStrategy
if ( fallThrough )
{
logger.debug( "Multi module project collection failed:{}"
LOGGER.debug( "Multi module project collection failed:{}"
+ "Detected that one of the modules of this multi module project uses another module as "
+ "plugin extension which still needed to be built. This is not possible within the same "
+ "reactor build. Another project collection strategy will be executed as result.",
@ -114,10 +114,10 @@ public class MultiModuleCollectionStrategy implements ProjectCollectionStrategy
File multiModuleProjectPom = modelLocator.locatePom( request.getMultiModuleProjectDirectory() );
if ( !multiModuleProjectPom.exists() )
{
logger.info( "Maven detected that the requested POM file is part of a multi module project, "
LOGGER.info( "Maven detected that the requested POM file is part of a multi module project, "
+ "but could not find a pom.xml file in the multi module root directory '{}'.",
request.getMultiModuleProjectDirectory() );
logger.info( "The reactor is limited to all projects under: " + request.getPom().getParent() );
LOGGER.info( "The reactor is limited to all projects under: " + request.getPom().getParent() );
return request.getPom();
}

View File

@ -71,7 +71,7 @@ public class SettingsXmlConfigurationProcessor
public static final File DEFAULT_GLOBAL_SETTINGS_FILE =
new File( System.getProperty( "maven.conf" ), "settings.xml" );
private final Logger logger = LoggerFactory.getLogger( SettingsXmlConfigurationProcessor.class );
private static final Logger LOGGER = LoggerFactory.getLogger( SettingsXmlConfigurationProcessor.class );
@Inject
private SettingsBuilder settingsBuilder;
@ -137,9 +137,9 @@ public class SettingsXmlConfigurationProcessor
request.getEventSpyDispatcher().onEvent( settingsRequest );
}
logger.debug( "Reading global settings from '{}'",
LOGGER.debug( "Reading global settings from '{}'",
getLocation( settingsRequest.getGlobalSettingsSource(), settingsRequest.getGlobalSettingsFile() ) );
logger.debug( "Reading user settings from '{}'",
LOGGER.debug( "Reading user settings from '{}'",
getLocation( settingsRequest.getUserSettingsSource(), settingsRequest.getUserSettingsFile() ) );
SettingsBuildingResult settingsResult = settingsBuilder.build( settingsRequest );
@ -151,16 +151,16 @@ public class SettingsXmlConfigurationProcessor
populateFromSettings( request, settingsResult.getEffectiveSettings() );
if ( !settingsResult.getProblems().isEmpty() && logger.isWarnEnabled() )
if ( !settingsResult.getProblems().isEmpty() && LOGGER.isWarnEnabled() )
{
logger.warn( "" );
logger.warn( "Some problems were encountered while building the effective settings" );
LOGGER.warn( "" );
LOGGER.warn( "Some problems were encountered while building the effective settings" );
for ( SettingsProblem problem : settingsResult.getProblems() )
{
logger.warn( "{} @ {}", problem.getMessage(), problem.getLocation() );
LOGGER.warn( "{} @ {}", problem.getMessage(), problem.getLocation() );
}
logger.warn( "" );
LOGGER.warn( "" );
}
}

View File

@ -31,15 +31,15 @@ import org.slf4j.LoggerFactory;
public class BaseSlf4jConfiguration
implements Slf4jConfiguration
{
private final Logger logger = LoggerFactory.getLogger( BaseSlf4jConfiguration.class );
private static final Logger LOGGER = LoggerFactory.getLogger( BaseSlf4jConfiguration.class );
public void setRootLoggerLevel( Level level )
{
logger.warn( "setRootLoggerLevel: operation not supported" );
LOGGER.warn( "setRootLoggerLevel: operation not supported" );
}
public void activate()
{
logger.warn( "reset(): operation not supported" );
LOGGER.warn( "reset(): operation not supported" );
}
}

View File

@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory;
public class UnsupportedSlf4jBindingConfiguration
extends BaseSlf4jConfiguration
{
private final Logger logger = LoggerFactory.getLogger( UnsupportedSlf4jBindingConfiguration.class );
private static final Logger LOGGER = LoggerFactory.getLogger( UnsupportedSlf4jBindingConfiguration.class );
private String slf4jBinding;
@ -51,8 +51,8 @@ public class UnsupportedSlf4jBindingConfiguration
@Override
public void activate()
{
logger.warn( "The SLF4J binding actually used is not supported by Maven: {}", slf4jBinding );
logger.warn( "Maven supported bindings are:" );
LOGGER.warn( "The SLF4J binding actually used is not supported by Maven: {}", slf4jBinding );
LOGGER.warn( "Maven supported bindings are:" );
String ls = System.lineSeparator();
@ -66,7 +66,7 @@ public class UnsupportedSlf4jBindingConfiguration
sb.append( ls ).append( "- " ).append( binding );
}
logger.warn( sb.toString() );
LOGGER.warn( sb.toString() );
}
}
}