[hg] main-silver: disable logger in debug mode

  • From: Alexander Simon < >
  • To:
  • Subject: [hg] main-silver: disable logger in debug mode
  • Date: Mon, 04 Feb 2013 07:31:12 -0800

changeset 7541cfe6b488 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/7541cfe6b488
description:
        disable logger in debug mode

diffstat:

 
dlight.libs.common/src/org/netbeans/modules/dlight/libs/common/PerformanceLogger.java
 |  19 +++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diffs (36 lines):

diff --git 
a/dlight.libs.common/src/org/netbeans/modules/dlight/libs/common/PerformanceLogger.java
 
b/dlight.libs.common/src/org/netbeans/modules/dlight/libs/common/PerformanceLogger.java
--- 
a/dlight.libs.common/src/org/netbeans/modules/dlight/libs/common/PerformanceLogger.java
+++ 
b/dlight.libs.common/src/org/netbeans/modules/dlight/libs/common/PerformanceLogger.java
@@ -42,6 +42,7 @@
 package org.netbeans.modules.dlight.libs.common;
 
 import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
 import java.lang.management.ThreadMXBean;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -189,7 +190,23 @@
     private static final ThreadMXBean threadMXBean = 
ManagementFactory.getThreadMXBean();
     
     static {
-        PROFILING_ENABLED = 
"true".equals(System.getProperty("dlight.libs.common.profiling.enabled", 
"true")); // NOI18N;
+        boolean isDebugMode = false;
+        RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
+        try {
+            List<String> args = runtime.getInputArguments();
+            if (args.contains("-Xdebug")) { //NOI18N
+                isDebugMode = true;
+            }
+        } catch (SecurityException ex) {
+        }
+        String enabled = 
System.getProperty("dlight.libs.common.profiling.enabled", "auto"); //NOI18N
+        if ("true".equals(enabled)) { //NOI18N
+            PROFILING_ENABLED = true;
+        } else if ("false".equals(enabled)) { //NOI18N
+            PROFILING_ENABLED = false;
+        } else {
+            PROFILING_ENABLED = !isDebugMode;
+        }
         boolean cpu = true;
         if (PROFILING_ENABLED) {
             try {

[hg] main-silver: disable logger in debug mode

Alexander Simon 02/04/2013

Project Features

About this Project

CND was started in November 2009, is owned by Leonid Lenyashin, and has 130 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close