Author: ruschein
Date: 2010-10-11 10:36:27 -0700 (Mon, 11 Oct 2010)
New Revision: 22201

Modified:
   cytoscape/trunk/application/src/main/java/cytoscape/CytoscapeInit.java
   cytoscape/trunk/application/src/main/java/cytoscape/logger/CyLogger.java
Log:
Untangled the logger / properties circular dependency.

Modified: cytoscape/trunk/application/src/main/java/cytoscape/CytoscapeInit.java
===================================================================
--- cytoscape/trunk/application/src/main/java/cytoscape/CytoscapeInit.java      
2010-10-11 17:13:49 UTC (rev 22200)
+++ cytoscape/trunk/application/src/main/java/cytoscape/CytoscapeInit.java      
2010-10-11 17:36:27 UTC (rev 22201)
@@ -110,7 +110,11 @@
        static {
                logger = CyLogger.getLogger(CytoscapeInit.class);
                logger.info("CytoscapeInit static initialization");
+
                initProperties();
+
+               final String debug = properties.getProperty("cytoscape.debug", 
"false"); 
+               logger.setDebugging(Boolean.parseBoolean(debug));
        }
 
        private static CyInitParams initParams;

Modified: 
cytoscape/trunk/application/src/main/java/cytoscape/logger/CyLogger.java
===================================================================
--- cytoscape/trunk/application/src/main/java/cytoscape/logger/CyLogger.java    
2010-10-11 17:13:49 UTC (rev 22200)
+++ cytoscape/trunk/application/src/main/java/cytoscape/logger/CyLogger.java    
2010-10-11 17:36:27 UTC (rev 22201)
@@ -1,16 +1,8 @@
  /*
   File: CyLogger.java
 
-  Copyright (c) 2008, The Cytoscape Consortium (www.cytoscape.org)
+  Copyright (c) 2008, 2010, The Cytoscape Consortium (www.cytoscape.org)
 
-  The Cytoscape Consortium is:
-  - Institute for Systems Biology
-  - University of California San Diego
-  - Memorial Sloan-Kettering Cancer Center
-  - Institut Pasteur
-  - Agilent Technologies
-  - University of California San Francisco
-
   This library is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as published
   by the Free Software Foundation; either version 2.1 of the License, or
@@ -47,22 +39,22 @@
  * will enable the LOG_DEBUG level of logging.  Otherwise, no debug level 
logging
  * will be done.
  */
-
 package cytoscape.logger;
 
+
 import cytoscape.CytoscapeInit;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Properties;
 
+
 public class CyLogger {
        private static HashMap<String,CyLogger> logMap = new HashMap();
        private static HashMap<LogLevel,List<CyLogHandler>> globalHandlerMap = 
new HashMap();
        private HashMap<LogLevel, List<CyLogHandler>> handlerMap = new 
HashMap();
        private String loggerName = null;
-       private boolean debugging = false;
+       private static boolean debugging = false;
 
        /**
         * Get a logger with the specified name
@@ -86,16 +78,16 @@
         * @param logClass the class this logger logs for
         * @return the logger to use
         */
-  public static CyLogger getLogger(Class logClass) {
-    return CyLogger.getLogger(logClass.getName());
-  }
+       public static CyLogger getLogger(Class logClass) {
+               return CyLogger.getLogger(logClass.getName());
+       }
 
        /**
         * Get the default ("cytoscape") logger
         *
         * @return the logger to use
         */
-  public static CyLogger getLogger() {
+       public static CyLogger getLogger() {
                return getLogger("cytoscape");
        }
 
@@ -106,14 +98,20 @@
        protected CyLogger(String name) {
                loggerName = name;
                logMap.put(name,this);
+               /*
                Properties properties = CytoscapeInit.getProperties();
                if (properties != null) {
                        debugging = false;
                        String debug = 
properties.getProperty("cytoscape.debug");
                        debugging = Boolean.parseBoolean(debug);
                }
+               */
        }
 
+       public static void setDebugging(final boolean on) {
+               debugging = on;
+       }
+
        /**
         * Log a debug message.
         *

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to