KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > scalagent > ksoap > KSoapTracing


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2003 - ScalAgent Distributed Technologies
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
18  * USA.
19  *
20  * Initial developer(s): Nicolas Tachker (ScalAgent)
21  */

22 package com.scalagent.ksoap;
23
24
25 /**
26  * The <code>KSoapTracing</code> class centralizes the log tracing for ksoap.
27  */

28 public class KSoapTracing {
29   public static int ERROR = 1;
30   public static int WARN = 2;
31   public static int INFO = 3;
32   public static int DEBUG = 4;
33
34   public static int traceLevel = 1;
35   public static boolean dbg = false;
36   public static boolean dbgReader = false;
37   public static boolean dbgWriter = false;
38
39   static {
40     String JavaDoc l = System.getProperty("traceLevel");
41     if (l != null && l != "") {
42       traceLevel = Integer.parseInt(l);
43     }
44     if (System.getProperty("dbg") != null)
45       dbg = true;
46     if (System.getProperty("dbgReader") != null)
47       dbgReader = true;
48     if (System.getProperty("dbgWriter") != null)
49       dbgWriter = true;
50   }
51   
52   public static void log(int level, String JavaDoc trace) {
53     if (level <= traceLevel)
54       System.out.println(trace);
55   }
56 }
57
Popular Tags