< prev index next >

src/java.desktop/share/classes/sun/awt/DebugSettings.java

Print this page


   1 /*
   2  * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  62  *
  63  * After the fix for 4638447 all the usage of DebugHelper
  64  * classes in Java code are replaced with the corresponding
  65  * Java Logging API calls. This file is now used only to
  66  * control native logging.
  67  *
  68  * To enable native logging you should set the following
  69  * system property to 'true': sun.awt.nativedebug. After
  70  * the native logging is enabled, the actual debug settings
  71  * are read the same way as described above (as before
  72  * the fix for 4638447).
  73  */
  74 public final class DebugSettings {
  75     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.debug.DebugSettings");
  76 
  77     /* standard debug property key names */
  78     static final String PREFIX = "awtdebug";
  79     static final String PROP_FILE = "properties";
  80 
  81     /* default property settings */
  82     private static final String DEFAULT_PROPS[] = {
  83         "awtdebug.assert=true",
  84         "awtdebug.trace=false",
  85         "awtdebug.on=true",
  86         "awtdebug.ctrace=false"
  87     };
  88 
  89     /* global instance of the settings object */
  90     private static final DebugSettings instance = new DebugSettings();
  91 
  92     private final Properties props = new Properties();
  93 
  94     static synchronized void init() {
  95         if (!instance.props.isEmpty()) {
  96             return;
  97         }
  98         NativeLibLoader.loadLibraries();
  99         instance.loadProperties();
 100         instance.loadNativeSettings();
 101     }
 102 


   1 /*
   2  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  62  *
  63  * After the fix for 4638447 all the usage of DebugHelper
  64  * classes in Java code are replaced with the corresponding
  65  * Java Logging API calls. This file is now used only to
  66  * control native logging.
  67  *
  68  * To enable native logging you should set the following
  69  * system property to 'true': sun.awt.nativedebug. After
  70  * the native logging is enabled, the actual debug settings
  71  * are read the same way as described above (as before
  72  * the fix for 4638447).
  73  */
  74 public final class DebugSettings {
  75     private static final PlatformLogger log = PlatformLogger.getLogger("sun.awt.debug.DebugSettings");
  76 
  77     /* standard debug property key names */
  78     static final String PREFIX = "awtdebug";
  79     static final String PROP_FILE = "properties";
  80 
  81     /* default property settings */
  82     private static final String[] DEFAULT_PROPS = {
  83         "awtdebug.assert=true",
  84         "awtdebug.trace=false",
  85         "awtdebug.on=true",
  86         "awtdebug.ctrace=false"
  87     };
  88 
  89     /* global instance of the settings object */
  90     private static final DebugSettings instance = new DebugSettings();
  91 
  92     private final Properties props = new Properties();
  93 
  94     static synchronized void init() {
  95         if (!instance.props.isEmpty()) {
  96             return;
  97         }
  98         NativeLibLoader.loadLibraries();
  99         instance.loadProperties();
 100         instance.loadNativeSettings();
 101     }
 102 


< prev index next >