Project

General

Profile

« Previous | Next » 

Revision 3078

Added by Matt Jones about 18 years ago

Eliminated the MetacatUtil.printMessage() method in favor of using the Log4J debugging methods.

View differences:

src/edu/ucsb/nceas/metacat/MetaCatUtil.java
114 114
            options = edu.ucsb.nceas.utilities.Options.getInstance();
115 115
        }
116 116
        if (options == null) {
117
        	MetaCatUtil.printMessage("options is null");
117
            Logger logMetacat = Logger.getLogger(MetaCatUtil.class);
118
        	logMetacat.info("options is null");
118 119
        }
119 120
        String value = options.getOption(optionName);
120 121
        return value;
......
224 225
        }
225 226
        return parameters;
226 227
    }
227

  
228
    /**
229
     * Utility method to print debugging messages. User can set debug level for
230
     * this message. The number is fewer, the message is more important
231
     *
232
     * @param msg, the content of the message
233
     * @param debugLevel, an integer indicating the message debug leve
234
     */
235
    /** 
236
     * Commenting out the function for now...
237
     * public static void debugMessage(String msg, int debugLevel)
238
     * {
239
     *   if (debug) {
240
     *       int limit = 1;
241
     *       try {
242
     *           limit = Integer.parseInt(getOption("debuglevel"));
243
     *
244
     *       } catch (Exception e) {
245
     *           System.out.println(e.getMessage());
246
     *       }
247
     *       //don't allow the user set debugLevel less than or equals 0
248
     *       if (debugLevel <= 0) {
249
     *           debugLevel = 1;
250
     *       }
251
     *
252
     *       if (debugLevel < limit) {
253
     *           System.err.println("@debugprefix@ " + msg);
254
     *       }
255
     *   }
256
     *}
257
     */
258

  
259

  
260
    /**
261
     * Utility method to print debugging messages. User can set debug level for
262
     * this message. The number is fewer, the message is more important
263
     *
264
     * @param msg, the content of the message
265
     * @param debugLevel, an integer indicating the message debug leve
266
     */
267
    public static void printMessage(String msg)
268
    {
269
    	System.err.println("@debugprefix@ " + msg);
270
    }
271
    
272 228
  
273 229
    public static Vector getOptionList(String optiontext)
274 230
    {
src/edu/ucsb/nceas/metacat/MetaCatServlet.java
142 142
    {
143 143
        try {
144 144
            super.init(config);
145
            Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
146
            
145 147
            ServletContext context = config.getServletContext();
146 148

  
147 149
            // Initialize the properties file for our options
......
154 156
            Options options = null;
155 157
            try {
156 158
                options = Options.initialize(propertyFile);
157
                MetaCatUtil.printMessage("Options configured: "
158
                        + options.getOption("configured"));
159
                logMetacat.info("Options configured: "
160
                    + options.getOption("configured"));
159 161
            } catch (IOException ioe) {
160
                Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
161 162
                logMetacat.error("Error in loading options: "
162 163
                        + ioe.getMessage());
163 164
            }
......
197 198
                    skinOption.load(fis);
198 199
                    fis.close();
199 200
                } catch (IOException ioe) {
200
                    Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
201 201
                    logMetacat.error("Error in loading options for skin " + "skinName" +" : "
202 202
                            + ioe.getMessage());
203 203
                }                
......
226 226

  
227 227
                // End timer
228 228
                long after = System.currentTimeMillis();
229
                MetaCatUtil.printMessage(" ------ Spatial Harvester Time  " + (after - before) + "ms");
229
                logMetacat.info(" ------ Spatial Harvester Time  " + (after - before) + "ms");
230 230

  
231 231
	    } else {
232
                MetaCatUtil.printMessage(" \n **** Spatial cache is not set to regenerate on restart");
232
                logMetacat.info(" \n **** Spatial cache is not set to regenerate on restart");
233 233
            }
234 234
           
235 235
           
236
            MetaCatUtil.printMessage("Metacat (" + Version.getVersion()
236
            logMetacat.info("Metacat (" + Version.getVersion()
237 237
                               + ") initialized.");
238 238

  
239 239
        } catch (ServletException ex) {
......
285 285
    
286 286
        if (MetaCatUtil.pathsForIndexing != null) {
287 287
    
288
            MetaCatUtil.printMessage("Indexing paths specified in metacat.properties....");
288
            logMetacat.debug("Indexing paths specified in metacat.properties....");
289 289
    
290 290
            DBConnection conn = null;
291 291
            int serialNumber = -1;
......
409 409
    
410 410
            }
411 411
    
412
            MetaCatUtil.printMessage("Path Indexing Completed");
412
            logMetacat.debug("Path Indexing Completed");
413 413
        }
414 414
    }    
415 415

  
src/edu/ucsb/nceas/metacat/DBConnectionPool.java
96 96
  {
97 97
    if (instance == null) {
98 98
      instance = new DBConnectionPool();
99
      MetaCatUtil.printMessage
100
      	("MaximumConnectionNumber: "+MAXIMUMCONNECTIONNUMBER);
101
      MetaCatUtil.printMessage
102
      	("Intial connection number: "+INITIALCONNECTIONNUMBER);
103
      MetaCatUtil.printMessage
104
      	("Increated connection Number: "+INCREASECONNECTIONNUMBER);
105
      MetaCatUtil.printMessage
106
      	("Maximum connection age: "+MAXIMUMAGE);
107
      MetaCatUtil.printMessage
108
      	("Maximum connection time: "+MAXIMUMCONNECTIONTIME);
109
      MetaCatUtil.printMessage
110
      	("Maximum usage count: "+MAXIMUMUSAGENUMBER);
111
      MetaCatUtil.printMessage
112
      	("Running recycle thread or not: "+DBCONNECTIONRECYCLETHREAD);
113
      MetaCatUtil.printMessage
114
      	("Cycle time of recycle: "+CYCLETIMEOFDBCONNECTION); 
99
      Logger log = Logger.getLogger(DBConnectionPool.class);
100
      log.info("MaximumConnectionNumber: "+MAXIMUMCONNECTIONNUMBER);
101
      log.info("Intial connection number: "+INITIALCONNECTIONNUMBER);
102
      log.info("Increated connection Number: "+INCREASECONNECTIONNUMBER);
103
      log.info("Maximum connection age: "+MAXIMUMAGE);
104
      log.info("Maximum connection time: "+MAXIMUMCONNECTIONTIME);
105
      log.info("Maximum usage count: "+MAXIMUMUSAGENUMBER);
106
      log.info("Running recycle thread or not: "+DBCONNECTIONRECYCLETHREAD);
107
      log.info("Cycle time of recycle: "+CYCLETIMEOFDBCONNECTION); 
115 108
    }
116 109
    return instance;
117
  }//getInstance
110
  }
118 111

  
119 112

  
120 113
  /**

Also available in: Unified diff