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 0CB73DAF2 for ; Thu, 6 Sep 2012 02:23:29 +0000 (UTC) Received: (qmail 3338 invoked by uid 500); 6 Sep 2012 02:23:28 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 3296 invoked by uid 500); 6 Sep 2012 02:23:28 -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 3288 invoked by uid 99); 6 Sep 2012 02:23:28 -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 02:23:28 +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 02:23:27 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 981A023888EA; Thu, 6 Sep 2012 02:22:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1381464 - in /db/derby/code/branches/10.9: ./ java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java Date: Thu, 06 Sep 2012 02:22:44 -0000 To: derby-commits@db.apache.org From: mamta@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120906022244.981A023888EA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mamta Date: Thu Sep 6 02:22:44 2012 New Revision: 1381464 URL: http://svn.apache.org/viewvc?rev=1381464&view=rev Log: DERBY-5240 (Log Operating system information to derby.log on boot ) Backporting to 10.9 Modified: db/derby/code/branches/10.9/ (props changed) db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java Propchange: db/derby/code/branches/10.9/ ------------------------------------------------------------------------------ Merged /db/derby/code/trunk:r1371041 Modified: db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java?rev=1381464&r1=1381463&r2=1381464&view=diff ============================================================================== --- db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java (original) +++ db/derby/code/branches/10.9/java/engine/org/apache/derby/impl/store/raw/data/BaseDataFileFactory.java Thu Sep 6 02:22:44 2012 @@ -135,6 +135,8 @@ public class BaseDataFileFactory private String jvmVersion; + private String osInfo; + private String jarCPath; private RawStoreFactory rawStoreFactory; // associated raw store factory @@ -261,6 +263,8 @@ public class BaseDataFileFactory jvmVersion = buildJvmVersion(); + osInfo = buildOSinfo(); + jarCPath = jarClassPath(getClass()); dataDirectory = startParams.getProperty(PersistentService.ROOT); @@ -368,6 +372,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)); @@ -2154,6 +2161,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.