[jboss-cvs] JBossAS SVN: r99956 - in projects/bootstrap/trunk: impl-as/src/main/java/org/jboss/bootstrap/impl/as/config and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jan 26 14:49:26 EST 2010
Author: ALRubinger
Date: 2010-01-26 14:49:24 -0500 (Tue, 26 Jan 2010)
New Revision: 99956
Modified:
projects/bootstrap/trunk/build/pom.xml
projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASBasedConfigurationValidator.java
projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java
projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/config/AbstractBasicConfigurationValidator.java
projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/config/AbstractBasicServerConfig.java
projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/AbstractBasicServerInitializer.java
projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/AbstractServer.java
projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/SecurityActions.java
projects/bootstrap/trunk/impl-mc/src/main/java/org/jboss/bootstrap/impl/mc/server/AbstractMCServerBase.java
projects/bootstrap/trunk/spi-test/pom.xml
Log:
[JBBOOT-124] Use formatting on logging instead of String concat+guards
Modified: projects/bootstrap/trunk/build/pom.xml
===================================================================
--- projects/bootstrap/trunk/build/pom.xml 2010-01-26 18:57:06 UTC (rev 99955)
+++ projects/bootstrap/trunk/build/pom.xml 2010-01-26 19:49:24 UTC (rev 99956)
@@ -27,8 +27,8 @@
<properties>
<!-- Versioning -->
- <version.org.jboss.logging_jboss.logging.log4j>2.0.6.GA</version.org.jboss.logging_jboss.logging.log4j>
- <version.org.jboss.logging_jboss.logging.spi>2.0.5.GA</version.org.jboss.logging_jboss.logging.spi>
+ <version.org.jboss.logging_jboss.logging.log4j>2.2.0.CR1</version.org.jboss.logging_jboss.logging.log4j>
+ <version.org.jboss.logging_jboss.logging.spi>2.2.0.CR1</version.org.jboss.logging_jboss.logging.spi>
<version.org.jboss.kernel_jboss.kernel>2.2.0.Alpha2</version.org.jboss.kernel_jboss.kernel>
<version.org.jboss_jbossxb>2.0.2.Beta3</version.org.jboss_jbossxb>
<version.org.jboss_jboss.common.core>2.2.17.GA</version.org.jboss_jboss.common.core>
Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASBasedConfigurationValidator.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASBasedConfigurationValidator.java 2010-01-26 18:57:06 UTC (rev 99955)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASBasedConfigurationValidator.java 2010-01-26 19:49:24 UTC (rev 99956)
@@ -134,7 +134,7 @@
this.require(config.isUsePlatformMBeanServer(), JBossASBasedServerConfig.PROP_KEY_JBOSSAS_PLATFORM_MBEANSERVER);
// Log
- log.debug("Configuration is valid: " + config);
+ log.debugf("Configuration is valid: %s", config);
}
//-------------------------------------------------------------------------------||
Modified: projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java
===================================================================
--- projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java 2010-01-26 18:57:06 UTC (rev 99955)
+++ projects/bootstrap/trunk/impl-as/src/main/java/org/jboss/bootstrap/impl/as/config/JBossASConfigurationInitializerImpl.java 2010-01-26 19:49:24 UTC (rev 99956)
@@ -77,7 +77,7 @@
IllegalStateException
{
// Log
- log.debug("Initializing: " + config);
+ log.debugf("Initializing: %s", config);
// Get the configuration properties
final Map<String, String> configProps = config.getProperties();
@@ -392,18 +392,15 @@
if (envVarValue != null)
{
returnValue = envVarValue;
- // Log at debug
- log.debug("Found environment variable \"" + envVarName + "\", so using value as override: " + envVarValue);
+ // Log at trace
+ log.tracef("Found environment variable \"%s\", so using value as override: %s", envVarName, envVarValue);
}
}
// If the object model value is specified, use it
if (currentValue != null && currentValue.length() > 0)
{
- if (log.isTraceEnabled())
- {
- log.trace("Object model has specified value for \"" + propertyName + "\": " + currentValue);
- }
+ log.tracef("Object model has specified value for \"%s\": %s", propertyName, currentValue);
returnValue = currentValue;
}
@@ -415,14 +412,15 @@
{
// Log as debug here as property-based override may be from command-line,
// so give the user a greater hint of what's going on
- log.debug("Got configuration property " + propertyName + ", so using as override: " + override);
+ log.debugf("Got configuration property %s, so using as override: %s", propertyName, override);
returnValue = override;
}
// Return
- log.debug("Resolved property: " + propertyName + " with currentValue = " + currentValue
- + ", environment variable name = " + envVarName + ", and defaultValue = " + defaultValue + " to: "
- + returnValue);
+ log
+ .tracef(
+ "Resolved property: %s with currentValue = %s, environment variable name = %s, and defaultValue = %s to: %s",
+ propertyName, currentValue, envVarName, defaultValue, returnValue);
return returnValue;
}
@@ -433,10 +431,7 @@
protected void applyPropertyOverrides(T config) throws IllegalArgumentException
{
// Log
- if (log.isTraceEnabled())
- {
- log.trace("Applying system property overrides...");
- }
+ log.trace("Applying system property overrides...");
// Precondition check
if (config == null)
@@ -500,10 +495,7 @@
if (bootstrapUrl == null && (home != null && name != null))
{
// Log
- if (log.isTraceEnabled())
- {
- log.trace("No bootstrap URL defined, constructing it from home and name...");
- }
+ log.trace("No bootstrap URL defined, constructing it from home and name...");
// Bootstrap name should not start with a slash when being treated as a relative URL
// to the bootstrap home.
@@ -526,7 +518,7 @@
}
// Log
- log.debug("New bootstrap URL: " + newBootstrapUrl.toExternalForm());
+ log.debugf("New bootstrap URL: %s", newBootstrapUrl.toExternalForm());
// Set
config.bootstrapUrl(newBootstrapUrl);
@@ -577,7 +569,7 @@
// Log if we'll use it
if (override != null && override.length() > 0)
{
- log.debug("Got system property " + propertyName + ", so using as override: " + override);
+ log.tracef("Got system property %s, so using as override: %s", propertyName, override);
}
// Return
Modified: projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/config/AbstractBasicConfigurationValidator.java
===================================================================
--- projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/config/AbstractBasicConfigurationValidator.java 2010-01-26 18:57:06 UTC (rev 99955)
+++ projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/config/AbstractBasicConfigurationValidator.java 2010-01-26 19:49:24 UTC (rev 99956)
@@ -55,7 +55,7 @@
public void validate(final T config) throws InvalidConfigurationException
{
// Log
- log.debug("Configuration passed on: " + config);
+ log.debugf("Configuration passed on: %s", config);
}
}
Modified: projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/config/AbstractBasicServerConfig.java
===================================================================
--- projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/config/AbstractBasicServerConfig.java 2010-01-26 18:57:06 UTC (rev 99955)
+++ projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/config/AbstractBasicServerConfig.java 2010-01-26 19:49:24 UTC (rev 99956)
@@ -408,10 +408,7 @@
}
// Log
- if (log.isTraceEnabled())
- {
- log.trace("Appended trailing slash to " + url + " to point to directory: " + newUrl);
- }
+ log.tracef("Appended trailing slash to %s to point to directory: %s", url, newUrl);
// Return it
return newUrl;
Modified: projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/AbstractBasicServerInitializer.java
===================================================================
--- projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/AbstractBasicServerInitializer.java 2010-01-26 18:57:06 UTC (rev 99955)
+++ projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/AbstractBasicServerInitializer.java 2010-01-26 19:49:24 UTC (rev 99956)
@@ -66,10 +66,7 @@
public synchronized void initialize(final K server) throws IllegalArgumentException, IllegalStateException
{
// Log
- if (log.isTraceEnabled())
- {
- log.trace("Request to initialize " + server + " using: " + this);
- }
+ log.tracef("Request to initialize %s using: %s",server,this);
// Precondition checks
if (server == null)
@@ -89,14 +86,12 @@
final T config = server.getConfiguration();
// Set System Properties
- if (log.isTraceEnabled())
- {
- log.trace("Setting system properties for " + server);
- }
+ log.tracef("Setting system properties for %s", server);
+
this.setSystemProperties(config);
// Log
- log.debug("Initialized " + server + ": " + this);
+ log.debugf("Initialized %s: %s", server, this);
}
@@ -107,10 +102,7 @@
public synchronized void cleanup(final K server) throws IllegalArgumentException, IllegalStateException
{
// Log
- if (log.isTraceEnabled())
- {
- log.trace("Preparing for shutdown...");
- }
+ log.trace("Preparing for shutdown...");
// Clear all system properties set
log.debug("Clearing all system properties set in initialization...");
Modified: projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/AbstractServer.java
===================================================================
--- projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/AbstractServer.java 2010-01-26 18:57:06 UTC (rev 99955)
+++ projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/AbstractServer.java 2010-01-26 19:49:24 UTC (rev 99956)
@@ -225,10 +225,7 @@
public synchronized void setConfiguration(final T configuration)
{
// Log and set
- if (log.isTraceEnabled())
- {
- log.trace("Set configuration: " + configuration);
- }
+ log.tracef("Set configuration: %s", configuration);
this.configuration = configuration;
}
@@ -260,10 +257,7 @@
public void shutdown() throws IllegalStateException, Exception
{
// Log
- if (log.isTraceEnabled())
- {
- log.trace("Received request to shutdown");
- }
+ log.trace("Received request to shutdown");
// If we're in startup
final Thread startupThread = this.startupThread;
@@ -302,32 +296,23 @@
this.sendStopJmxNotification();
// Shutdown the Bootstraps
- if (log.isTraceEnabled())
- {
- log.trace("Shutting down bootstraps");
- }
+ log.trace("Shutting down bootstraps");
this.shutdownBootstraps();
// Shutdown
- if (log.isTraceEnabled())
- {
- log.trace("Calling implementation class shutdown...");
- }
+ log.trace("Calling implementation class shutdown...");
this.doShutdown();
// Let the initializer clean up
final ServerInitializer<K, T> serverInitializer = this.getServerInitializer();
if (serverInitializer != null)
{
- if (log.isTraceEnabled())
- {
- log.trace("Calling to clean up for shutdown: " + serverInitializer);
- }
+ log.tracef("Calling to clean up for shutdown: %s", serverInitializer);
serverInitializer.cleanup(this.covarientReturn());
}
// Done and set states
- log.info("Stopped: " + this + " in " + watch);
+ log.infof("Stopped: %s in %s", this, watch);
// So we fire "stopped" events and draw the difference
// between IDLE (which may also designate pre-start)
this.setState(LifecycleState.STOPPED);
@@ -341,10 +326,7 @@
public void start() throws IllegalStateException, Exception
{
// Log
- if (log.isTraceEnabled())
- {
- log.trace("Received request to start");
- }
+ log.trace("Received request to start");
// Invoke init() if necessary
if (getState().equals(LifecycleState.INSTANCIATED))
@@ -422,34 +404,28 @@
checkState(required, actual);
// Initiate start sequence
- log.info("Starting: " + thisRef);
+ log.infof("Starting: %s", thisRef);
final StopWatch watch = new StopWatch(true);
setState(LifecycleState.STARTING);
// Start
- if (log.isTraceEnabled())
- {
- log.trace("Entering implementation class start...");
- }
+ log.trace("Entering implementation class start...");
doStart();
// Run the bootstraps
- if (log.isTraceEnabled())
- {
- log.trace("Starting bootstraps...");
- }
+ log.trace("Starting bootstraps...");
startBootstraps();
// Send JMX Start Notification
sendStartJmxNotification();
// Done
- log.info(thisRef + " Started in " + watch);
+ log.infof("%s Started in %s", thisRef, watch);
setState(LifecycleState.STARTED);
}
catch (final Exception e)
{
- log.debug("Encountered exception while starting, caching it to be thrown later: " + e);
+ log.debugf("Encountered exception while starting, caching it to be thrown later: %s", e);
this.exception = e;
return;
}
@@ -542,7 +518,7 @@
this.setState(LifecycleState.PRE_INIT);
// Log
- log.debug("Initializing server: " + this);
+ log.debugf("Initializing server: %s", this);
// Do the actual initialization logic
this.doInitialize();
@@ -577,25 +553,16 @@
final ConfigurationInitializer<T> configInitializer = this.getConfigInitializer();
if (configInitializer != null)
{
- if (log.isTraceEnabled())
- {
- log.trace("Performing configuration initialization...");
- }
+ log.trace("Performing configuration initialization...");
configInitializer.initialize(config);
}
else
{
- if (log.isTraceEnabled())
- {
- log.trace("No configuration initializer supplied, skipping");
- }
+ log.trace("No configuration initializer supplied, skipping");
}
// Validate
- if (log.isTraceEnabled())
- {
- log.trace("Validating config...");
- }
+ log.trace("Validating config...");
this.validate(config);
/*
@@ -608,7 +575,7 @@
}
else
{
- log.debug("No initializer defined, skipping initialization of " + this);
+ log.debugf("No initializer defined, skipping initialization of %s", this);
}
}
@@ -630,7 +597,7 @@
this.checkMutable(this.getState());
this.serverInitializer = serverInitializer;
- log.debug("Set server initializer to " + serverInitializer);
+ log.debugf("Set server initializer to %s", serverInitializer);
}
/* (non-Javadoc)
@@ -650,7 +617,7 @@
this.checkMutable(this.getState());
this.configInitializer = configInitializer;
- log.debug("Set config initializer to " + configInitializer);
+ log.debugf("Set config initializer to %s", configInitializer);
}
/* (non-Javadoc)
@@ -661,7 +628,7 @@
// Precondition check
this.checkMutable(this.getState());
- log.debug("Setting validator to: " + validator);
+ log.debugf("Setting validator to: %s", validator);
this.validator = validator;
}
@@ -744,7 +711,7 @@
for (final LifecycleEventHandler handler : handlers)
{
handlersForEvent.add(handler);
- log.debug("Added lifecycle handler " + handler + " to fire upon state change to " + state + " for " + this);
+ log.debugf("Added lifecycle handler %s to fire upon state change to %s for %s", handler, state, this);
}
}
@@ -759,7 +726,7 @@
// Remove and return
final boolean removed = handlers.remove(handler);
- log.debug("Removed lifecycle handler " + handler + " from firing upon state change to " + state + " for " + this);
+ log.debugf("Removed lifecycle handler %s from firing upon state change to %s for %s", handler, state, this);
return removed;
}
@@ -822,7 +789,7 @@
final Notification startNotification = new Notification(type, this, sequenceNumber);
startNotification.setUserData(System.currentTimeMillis());
this.sendNotification(startNotification);
- log.debug("Sent JMX Notification: " + type);
+ log.debugf("Sent JMX Notification: %s", type);
}
/**
@@ -891,11 +858,12 @@
{
bootstrap.shutdown(typedServer);
// Remove bootstrap from started list
- if(!startedBootstraps.remove(bootstrap)) {
- log.warn("Failed to remove bootstrap after shutdown: " + bootstrap);
+ if (!startedBootstraps.remove(bootstrap))
+ {
+ log.warnf("Failed to remove bootstrap after shutdown: %s", bootstrap);
}
}
- catch (Throwable t)
+ catch (final Throwable t)
{
log.warn("Error shutting down bootstrap: " + bootstrap, t);
}
@@ -954,11 +922,8 @@
handlers = new CopyOnWriteArraySet<LifecycleEventHandler>();
// Put this new list into the backing Map to prevent null access
this.eventHandlers.put(state, handlers);
- if (log.isTraceEnabled())
- {
- log.trace("Placed empty backing map for lifecycle event handers upon state change into " + state + " for: "
- + this);
- }
+ log.tracef("Placed empty backing map for lifecycle event handers upon state change into %s for: %s", state,
+ this);
}
// Return
@@ -1041,15 +1006,12 @@
// Is specified, validate
if (validator != null)
{
- log.debug("Validating configuration using: " + validator);
+ log.debugf("Validating configuration using: %s", validator);
validator.validate(this.getConfiguration());
}
else
{
- if (log.isTraceEnabled())
- {
- log.trace("No validator defined, skipping validation upon configuration");
- }
+ log.trace("No validator defined, skipping validation upon configuration");
}
}
@@ -1107,10 +1069,8 @@
}
// Log and set
- if (log.isTraceEnabled())
- {
- log.trace("Setting " + LifecycleState.class.getSimpleName() + " to: " + state);
- }
+ log.tracef("Setting %s to: %s", LifecycleState.class.getSimpleName(), state);
+
this.state = state;
// Fire handlers registered for event changes to this state
@@ -1120,10 +1080,7 @@
try
{
// Log
- if (log.isTraceEnabled())
- {
- log.trace("Firing event handler for state change to " + state + ": " + handler);
- }
+ log.tracef("Firing event handler for state change to %s: %s", state, handler);
// Fire
handler.handleEvent(state);
Modified: projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/SecurityActions.java
===================================================================
--- projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/SecurityActions.java 2010-01-26 18:57:06 UTC (rev 99955)
+++ projects/bootstrap/trunk/impl-base/src/main/java/org/jboss/bootstrap/impl/base/server/SecurityActions.java 2010-01-26 19:49:24 UTC (rev 99956)
@@ -113,10 +113,7 @@
String previousValue = System.clearProperty(key);
// Log
- if (log.isTraceEnabled())
- {
- log.trace("Removed system property \"" + key + "\" which had previous value: " + previousValue);
- }
+ log.tracef("Removed system property \"%s\" which had previous value: %s", key, previousValue);
// Return
return null;
@@ -151,15 +148,9 @@
public Object run() throws Exception
{
- if (log.isTraceEnabled())
- {
- log.trace("Attempting to create new instance of " + clazz);
- }
+ log.tracef("Attempting to create new instance of %s", clazz);
final Object obj = clazz.newInstance();
- if (log.isTraceEnabled())
- {
- log.trace("Created " + obj);
- }
+ log.tracef("Created %s", obj);
return obj;
}
Modified: projects/bootstrap/trunk/impl-mc/src/main/java/org/jboss/bootstrap/impl/mc/server/AbstractMCServerBase.java
===================================================================
--- projects/bootstrap/trunk/impl-mc/src/main/java/org/jboss/bootstrap/impl/mc/server/AbstractMCServerBase.java 2010-01-26 18:57:06 UTC (rev 99955)
+++ projects/bootstrap/trunk/impl-mc/src/main/java/org/jboss/bootstrap/impl/mc/server/AbstractMCServerBase.java 2010-01-26 19:49:24 UTC (rev 99956)
@@ -239,10 +239,7 @@
final BasicBootstrap bootstrap = this.getBootstrap();
if (bootstrap == null)
{
- if (log.isTraceEnabled())
- {
- log.trace("Re-initializing the underlying bootstrap...");
- }
+ log.trace("Re-initializing the underlying bootstrap...");
this.initializeBootstrap();
log.debug("Underlying MC Bootstrap re-initialized.");
}
@@ -283,7 +280,7 @@
builder.ignoreStop(); // Stop on the server is called by the client, don't double-stop
try
{
- log.debug("Installing " + this + " into MC under key: " + mcServerBindName);
+ log.debugf("Installing %s into MC under key: %s", this, mcServerBindName);
controller.install(builder.getBeanMetaData(), this);
}
catch (Throwable t)
@@ -298,7 +295,7 @@
{
log.warn("No bootstrap descriptors defined");
}
- log.info("Starting Microcontainer, Bootstrap Descriptors: " + bootstrapDescriptors);
+ log.infof("Starting Microcontainer, Bootstrap Descriptors: %s", bootstrapDescriptors);
// Create an xml deployer
kernelDeployer = new TempBasicXMLDeployer(kernel);
@@ -309,10 +306,7 @@
{
final String bootstrapDescriptorName = bootstrapDescriptor.getName();
final InputStream bootstrapDescriptorContent = bootstrapDescriptor.getContent();
- if (log.isDebugEnabled())
- {
- log.debug("Deploying bootstrap descriptor: " + bootstrapDescriptorName);
- }
+ log.debugf("Deploying bootstrap descriptor: %s", bootstrapDescriptorName);
kernelDeployer.deploy(bootstrapDescriptorName, bootstrapDescriptorContent);
}
@@ -357,10 +351,7 @@
final BasicBootstrap bootstrap = new BasicBootstrap();
bootstrap.run();
this.bootstrap = bootstrap;
- if (log.isTraceEnabled())
- {
- log.trace("Created and run: " + bootstrap);
- }
+ log.tracef("Created and run: %s", bootstrap);
}
@Override
Modified: projects/bootstrap/trunk/spi-test/pom.xml
===================================================================
--- projects/bootstrap/trunk/spi-test/pom.xml 2010-01-26 18:57:06 UTC (rev 99955)
+++ projects/bootstrap/trunk/spi-test/pom.xml 2010-01-26 19:49:24 UTC (rev 99956)
@@ -26,8 +26,8 @@
<!-- Versioning -->
<version.org.jboss.aop_jboss.aop>2.0.0.SP1</version.org.jboss.aop_jboss.aop>
- <version.org.jboss.logging_jboss.logging.log4j>2.0.6.GA</version.org.jboss.logging_jboss.logging.log4j>
- <version.org.jboss.logging_jboss.logging.spi>2.0.5.GA</version.org.jboss.logging_jboss.logging.spi>
+ <version.org.jboss.logging_jboss.logging.log4j>2.2.0.CR1</version.org.jboss.logging_jboss.logging.log4j>
+ <version.org.jboss.logging_jboss.logging.spi>2.2.0.CR1</version.org.jboss.logging_jboss.logging.spi>
<version.org.jboss.kernel_jboss.kernel>2.2.0.Alpha2</version.org.jboss.kernel_jboss.kernel>
<version.org.jboss.kernel_jboss.aop.mc.int>2.2.0.Alpha2</version.org.jboss.kernel_jboss.aop.mc.int>
<version.org.jboss_jbossxb>2.0.2.Beta4</version.org.jboss_jbossxb>
More information about the jboss-cvs-commits
mailing list