com/scalagent/kjoram/JoramTracing.java

00001 /*
00002  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
00003  * Copyright (C) 2001 - ScalAgent Distributed Technologies
00004  * Copyright (C) 1996 - Dyade
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or any later version.
00010  * 
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00019  * USA.
00020  *
00021  * Initial developer(s): Nicolas Tachker (ScalAgent)
00022  * Contributor(s):
00023  */
00024 package com.scalagent.kjoram;
00025 
00029 public class JoramTracing {
00030   public static int ERROR = 1;
00031   public static int WARN = 2;
00032   public static int INFO = 3;
00033   public static int DEBUG = 4;
00034 
00035   public static int traceLevel = 1;
00036 
00037   public static boolean dbgClient = false;
00038   public static boolean dbgAdmin = false;
00039   public static boolean dbg = false;
00040 
00041   static {
00042     String l = System.getProperty("traceLevel");
00043     if (l != null && l != "") {
00044       traceLevel = Integer.parseInt(l);
00045     }
00046     if (System.getProperty("dbgClient") != null)
00047       dbgClient = true;
00048     if (System.getProperty("dbgAdmin") != null)
00049       dbgAdmin = true;
00050     if (System.getProperty("dbg") != null)
00051       dbg = true;
00052   }
00053   
00054   public static void log(int level, String trace) {
00055     if (level <= traceLevel)
00056       System.out.println(trace);
00057   }
00058 
00059   public static void log(int level, Exception exc) {
00060     log(level,exc.toString());
00061   }
00062 }

Generated on Tue Sep 16 16:14:24 2008 for joram by  doxygen 1.5.0