Project

General

Profile

« Previous | Next » 

Revision 1394

Added by Jing Tao almost 22 years ago

Change the debugMessage method. Only debug is true and debug level is higher, the statement can be print out.

View differences:

src/edu/ucsb/nceas/metacat/MetaCatUtil.java
48 48
  public static AbstractDatabase dbAdapter;
49 49
  private static PropertyResourceBundle options = null;
50 50
  private static String propertiesFile = "edu.ucsb.nceas.metacat.metacat";
51
  private static boolean debug = false;
51
  private static boolean debug = true;
52 52

  
53 53
  //private Hashtable connectionPool = new Hashtable();
54 54

  
......
209 209
   */
210 210
  public static void debugMessage(String msg, int debugLevel) 
211 211
  {
212
    int limit = 1;
213
    try 
212
    if (debug)
214 213
    {
215
      limit=Integer.parseInt(getOption("debuglevel"));
214
      int limit = 1;
215
      try 
216
      {
217
        limit=Integer.parseInt(getOption("debuglevel"));
216 218
     
217
    }
218
    catch (Exception e)
219
    {
220
      System.out.println(e.getMessage());
221
    }
222
    //don't allow the user set debugLevel less than or equals 0
223
    if (debugLevel<=0)
224
    {
225
      debugLevel=1;
226
    }
219
      }
220
      catch (Exception e)
221
      {
222
        System.out.println(e.getMessage());
223
      }
224
      //don't allow the user set debugLevel less than or equals 0
225
      if (debugLevel<=0)
226
      {
227
        debugLevel=1;
228
      }
227 229
    
228
    if (debugLevel < limit) 
229
    {
230
      System.err.println(msg);
230
      if (debugLevel < limit) 
231
      {
232
        System.err.println(msg);
233
      }
231 234
    }
232 235
  }
233 236
  

Also available in: Unified diff