[jboss-cvs] JBossAS SVN: r85188 - in projects/bootstrap/trunk/src: test/java/org/jboss/bootstrap/test/jboot5/unit and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Mar 3 16:12:55 EST 2009
Author: ALRubinger
Date: 2009-03-03 16:12:54 -0500 (Tue, 03 Mar 2009)
New Revision: 85188
Modified:
projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/AbstractServerImpl.java
projects/bootstrap/trunk/src/test/java/org/jboss/bootstrap/test/jboot5/unit/CleanShutdownOnIncompleteInitTestCase.java
Log:
[JBBOOT-17] Instead of using a default logger, check that logging is initialized in Server lifecycle
Modified: projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/AbstractServerImpl.java
===================================================================
--- projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/AbstractServerImpl.java 2009-03-03 21:03:26 UTC (rev 85187)
+++ projects/bootstrap/trunk/src/main/java/org/jboss/bootstrap/AbstractServerImpl.java 2009-03-03 21:12:54 UTC (rev 85188)
@@ -58,7 +58,7 @@
implements ServerProcess, NotificationEmitter
{
/** Instance logger. */
- protected Logger log = Logger.getLogger(AbstractServerImpl.class.getName() + " - [DEFAULT]");
+ protected Logger log;
/** Container for version information. */
private final Version version = Version.getInstance();
@@ -192,8 +192,7 @@
// Set the VM temp directory to the server tmp dir
boolean overrideTmpDir = Boolean.getBoolean("jboss.server.temp.dir.overrideJavaTmpDir");
if (overrideTmpDir)
- {
- //File serverTmpDir = config.getServerTempDir(); //TODO Put this back when we go back to File
+ {
File serverTmpDir = config.getServerTempDir();
System.setProperty("java.io.tmpdir", serverTmpDir.toString());
}
@@ -437,7 +436,10 @@
try
{
Runtime.getRuntime().addShutdownHook(shutdownHook);
- log.debug("Shutdown hook added " + shutdownHook);
+ if (log != null && log.isDebugEnabled())
+ {
+ log.debug("Shutdown hook added " + shutdownHook);
+ }
}
catch (Exception e)
{
@@ -467,7 +469,10 @@
if (config.isInstallLifeThread())
{
lifeThread = new LifeThread();
- log.debug("Installing life thread " + lifeThread);
+ if (log != null && log.isDebugEnabled())
+ {
+ log.debug("Installing life thread " + lifeThread);
+ }
lifeThread.start();
}
@@ -483,17 +488,25 @@
if (jbossPackage != null)
{
// Tell the world how fast it was =)
- log.info("JBoss (Microcontainer) [" + jbossPackage.getImplementationVersion() +
- "] Started in " + watch);
+ if (log != null)
+ {
+ log.info("JBoss (Microcontainer) [" + jbossPackage.getImplementationVersion() + "] Started in " + watch);
+ }
}
else
{
- log.info("JBoss (Microcontainer) [unknown version] Started in " + watch);
+ if (log != null)
+ {
+ log.info("JBoss (Microcontainer) [unknown version] Started in " + watch);
+ }
}
}
catch (Throwable t)
{
- log.debug("Failed to start", t);
+ if (log != null && log.isDebugEnabled())
+ {
+ log.debug("Failed to start", t);
+ }
if (t instanceof Exception)
throw (Exception)t;
@@ -527,7 +540,7 @@
*/
protected void shutdownServer()
{
- if (log.isTraceEnabled())
+ if (log != null && log.isTraceEnabled())
log.trace("Shutdown caller:", new Throwable("Here"));
// avoid entering twice; may happen when called directly
@@ -559,7 +572,10 @@
}
catch (Throwable t)
{
- log.warn("Error shutting down bootstrap: " + bootstrap, t);
+ if (log != null)
+ {
+ log.warn("Error shutting down bootstrap: " + bootstrap, t);
+ }
}
}
}
@@ -575,7 +591,10 @@
finally
{
// Done
- log.info("Shutdown complete");
+ if (log != null)
+ {
+ log.info("Shutdown complete");
+ }
System.out.println("Shutdown complete");
}
}
@@ -590,7 +609,7 @@
*/
public void shutdown() throws IllegalStateException
{
- if (log.isTraceEnabled())
+ if (log != null && log.isTraceEnabled())
log.trace("Shutdown caller:", new Throwable("Here"));
if (!started)
@@ -602,10 +621,15 @@
isInShutdown = true;
boolean exitOnShutdown = config.getExitOnShutdown();
boolean blockingShutdown = config.getBlockingShutdown();
- log.info("Shutting down the server, blockingShutdown: " + blockingShutdown);
-
- log.debug("exitOnShutdown: " + exitOnShutdown);
- log.debug("blockingShutdown: " + blockingShutdown);
+ if (log != null)
+ {
+ log.info("Shutting down the server, blockingShutdown: " + blockingShutdown);
+ if (log.isDebugEnabled())
+ {
+ log.debug("exitOnShutdown: " + exitOnShutdown);
+ log.debug("blockingShutdown: " + blockingShutdown);
+ }
+ }
if (exitOnShutdown)
{
@@ -755,7 +779,6 @@
Runtime.getRuntime().traceInstructions(flag.booleanValue());
}
-
///////////////////////////////////////////////////////////////////////////
// Server Information //
///////////////////////////////////////////////////////////////////////////
Modified: projects/bootstrap/trunk/src/test/java/org/jboss/bootstrap/test/jboot5/unit/CleanShutdownOnIncompleteInitTestCase.java
===================================================================
--- projects/bootstrap/trunk/src/test/java/org/jboss/bootstrap/test/jboot5/unit/CleanShutdownOnIncompleteInitTestCase.java 2009-03-03 21:03:26 UTC (rev 85187)
+++ projects/bootstrap/trunk/src/test/java/org/jboss/bootstrap/test/jboot5/unit/CleanShutdownOnIncompleteInitTestCase.java 2009-03-03 21:12:54 UTC (rev 85188)
@@ -23,6 +23,8 @@
import java.util.Properties;
+import junit.framework.TestCase;
+
import org.jboss.bootstrap.NoInitServerImpl;
import org.jboss.bootstrap.spi.Server;
import org.junit.Test;
@@ -62,8 +64,8 @@
}
catch (Exception e)
{
- throw e;
- //TestCase.fail("Startup/shutdown sequence without proper configuration should be clean, got exception: " + e);
+ e.printStackTrace();
+ TestCase.fail("Startup/shutdown sequence without proper configuration should be clean, got exception: " + e);
}
}
More information about the jboss-cvs-commits
mailing list