Return-Path: X-Original-To: apmail-db-derby-commits-archive@www.apache.org Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EA2BDD371 for ; Thu, 6 Sep 2012 23:47:04 +0000 (UTC) Received: (qmail 80598 invoked by uid 500); 6 Sep 2012 23:47:04 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 80538 invoked by uid 500); 6 Sep 2012 23:47:04 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 80530 invoked by uid 99); 6 Sep 2012 23:47:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Sep 2012 23:47:04 +0000 X-ASF-Spam-Status: No, hits=-1997.1 required=5.0 tests=ALL_TRUSTED,FILL_THIS_FORM_SHORT X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Sep 2012 23:47:03 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 1F10E2388980; Thu, 6 Sep 2012 23:46:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1381805 - in /db/derby/code/branches/10.6: ./ java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java Date: Thu, 06 Sep 2012 23:46:20 -0000 To: derby-commits@db.apache.org From: mamta@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120906234620.1F10E2388980@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mamta Date: Thu Sep 6 23:46:19 2012 New Revision: 1381805 URL: http://svn.apache.org/viewvc?rev=1381805&view=rev Log: DERBY-5240 (Log Operating system information to derby.log on boot ) Backporting to 10.6 Modified: db/derby/code/branches/10.6/ (props changed) db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java Propchange: db/derby/code/branches/10.6/ ------------------------------------------------------------------------------ Merged /db/derby/code/trunk:r1371041 Modified: db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java?rev=1381805&r1=1381804&r2=1381805&view=diff ============================================================================== --- db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java (original) +++ db/derby/code/branches/10.6/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java Thu Sep 6 23:46:19 2012 @@ -146,6 +146,8 @@ public class BaseDataFileFactory private String jvmVersion; + private String osInfo; + private String jarCPath; private RawStoreFactory rawStoreFactory; // associated raw store factory @@ -274,6 +276,8 @@ public class BaseDataFileFactory jvmVersion = buildJvmVersion(); + osInfo = buildOSinfo(); + jarCPath = jarClassPath(getClass()); dataDirectory = startParams.getProperty(PersistentService.ROOT); @@ -382,6 +386,9 @@ public class BaseDataFileFactory //Log the JVM version info logMsg(jvmVersion); + //Log the OS info + logMsg(osInfo); + //Log derby.system.home It will have null value if user didn't set it logMsg(Property.SYSTEM_HOME_PROPERTY+"=" + PropertyUtil.getSystemProperty(Property.SYSTEM_HOME_PROPERTY)); @@ -2215,6 +2222,32 @@ public class BaseDataFileFactory }); } + /** + * Return values of system properties that identify the OS. + * Will catch SecurityExceptions and note them for displaying information. + * @return the Java system property value for the OS or a string capturing a + * security exception. + */ + private static String buildOSinfo () { + return (String)AccessController.doPrivileged(new PrivilegedAction(){ + public Object run() { + String osInfo = ""; + try { + String currentProp = PropertyUtil.getSystemProperty("os.name"); + if (currentProp != null) + osInfo = "os.name="+currentProp+"\n"; + if ((currentProp = PropertyUtil.getSystemProperty("os.arch")) != null) + osInfo += "os.arch="+currentProp+"\n"; + if ((currentProp = PropertyUtil.getSystemProperty("os.version")) != null) + osInfo += "os.version="+currentProp; + } + catch(SecurityException se){ + return se.getMessage(); + } + return osInfo; + } + }); + } /** * Return values of system properties that identify the JVM.