You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by km...@apache.org on 2010/04/16 18:58:48 UTC
svn commit: r934996 - in /db/derby/code/trunk/java/engine/org/apache/derby:
iapi/reference/Property.java impl/store/raw/data/BaseDataFileFactory.java
Author: kmarsden
Date: Fri Apr 16 16:58:47 2010
New Revision: 934996
URL: http://svn.apache.org/viewvc?rev=934996&view=rev
Log:
DERBY-4588 Provide a diagnostic property that will print a stack trace on succes
sful boot to help diagnose dual boot issues after the DERBY-700 fix
To use, set the property derby.stream.error.logBootTrace=true
A stack trace will print in the derby.log on boot and shutdown.
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/Property.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/Property.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/Property.java?rev=934996&r1=934995&r2=934996&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/Property.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/reference/Property.java Fri Apr 16 16:58:47 2010
@@ -75,6 +75,17 @@ public interface Property {
*/
String LOG_SEVERITY_LEVEL = "derby.stream.error.logSeverityLevel";
+ /**
+ * derby.stream.error.logBootTrace
+ * <BR>
+ * defaults to false. If set to true logs a stack trace to
+ * the error stream on successful boot or shutdown.
+ * This can be useful when trying to debug dual boot
+ * scenarios especially with multiple class loaders.
+ *
+ */
+
+ String LOG_BOOT_TRACE = "derby.stream.error.logBootTrace";
/**
derby.stream.error.file=<b>absolute or relative error log filename</b>
Takes precendence over derby.stream.error.method.
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java?rev=934996&r1=934995&r2=934996&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java Fri Apr 16 16:58:47 2010
@@ -354,7 +354,8 @@ public class BaseDataFileFactory
String readOnlyMsg = (isReadOnly())
? MessageService.getTextMessage(MessageId.STORE_BOOT_READONLY_MSG)
: "";
-
+ boolean logBootTrace = Boolean.valueOf(startParams.getProperty(Property.LOG_BOOT_TRACE,
+ PropertyUtil.getSystemProperty(Property.LOG_BOOT_TRACE))).booleanValue();
logMsg(CheapDateFormatter.formatDate(bootTime) +
MessageService.getTextMessage(MessageId.STORE_BOOT_MSG,
jbmsVersion,
@@ -364,6 +365,8 @@ public class BaseDataFileFactory
(Object) this.getClass().getClassLoader()
));
+ if (logBootTrace)
+ Monitor.logThrowable(new Throwable("boot trace"));
uf = null;
@@ -461,6 +464,7 @@ public class BaseDataFileFactory
}
long shutdownTime = System.currentTimeMillis();
+ boolean logBootTrace = PropertyUtil.getSystemBoolean(Property.LOG_BOOT_TRACE);
logMsg("\n" + CheapDateFormatter.formatDate(shutdownTime) +
MessageService.getTextMessage(
MessageId.STORE_SHUTDOWN_MSG,
@@ -469,6 +473,10 @@ public class BaseDataFileFactory
// Cast to object so we don't get just the toString()
// method
(Object) this.getClass().getClassLoader()));
+
+ if (logBootTrace)
+ Monitor.logThrowable(new Throwable("shutdown trace"));
+
istream.println(LINE);
if (!isCorrupt)