KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > common > util > diagnostics > ReporterTester


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.tools.common.util.diagnostics;
25
26 import java.io.*;
27
28 /** General Purpose Debugging Output
29  ** -- create a ri object and then write with
30  ** pr()
31  ** If you construct with an Object -- that Object's class name will automatically be prepended to each message
32  ** If you use pr(String metName, String mesg) -- the metName will be added to the ObjectName
33  ** The output of ri is controlled by an environmental variable
34  ** if you call it with java -DaibDebug=true -- it gets turned on...
35  **/

36
37 class foo
38 {
39     public String JavaDoc toString() { return "Hi There!!"; }//NOI18N
40
}
41
42 public class ReporterTester
43 {
44     
45     ///////////////////////////////////////////////////////////////////////////////////////////////////////
46

47     public static void main(String JavaDoc[] args)
48     {
49         ReporterTester rt = new ReporterTester();
50         /*
51         ReporterImpl ri = new ReporterImpl(2);
52         ReporterImpl rj = new ReporterImpl("Second One", 0);
53
54         ri.ignoreRegistry();
55         ri.dump(rt);
56         ri.dump(rt, "This is an Object Dump");
57         ri.verbose("This is Verbose Comment");
58         ri.info("This is an INFO comment");
59         ri.warn("This is a Warning");
60         ri.error("This is an Error");
61         ri.critical("This is a Critical Error");
62         ri.warn(new foo());
63         ri.verbose(new foo());
64         ri.verbose(new StackTrace());
65
66         rj.ignoreRegistry();
67         rj.dump(rt);
68         rj.dump(rt, "This is an Object Dump");
69         rj.verbose("This is Verbose Comment");
70         rj.info("This is an INFO comment");
71         rj.warn("This is a Warning");
72         rj.error("This is an Error");
73         rj.critical("This is a Critical Error");
74         rj.warn(new foo());
75         rj.verbose(new foo());
76         rj.verbose(new StackTrace());
77 */

78         CallerInfo.addToGlobalIgnore(rt);
79         Goo goo = new Goo();
80         
81
82     }
83     private int junk = 5; // so dump() has something to work with!
84
protected String JavaDoc sss = "Foo";//NOI18N
85
}
86
87 class Goo
88 {
89     Goo()
90     {
91         /*
92         int iid = Reporter.createReporter("Third One");
93         ReporterImpl rk = Reporter.get(iid);
94         rk.ignoreRegistry();
95         Reporter.get(0).ignoreRegistry();
96         */

97         for(int i = 0; i < 25; i++)
98             Reporter.crit("Reporter CRITICAL Message #" + i);//NOI18N // +"asdkl slkd aklsdalksdlaksdalksd aslkdalkd alskdalskd aslkdalksd alskda lskla skdlaskd asdalskdalskd alsdia lskd");
99
for(int i = 0; i < 25; i++)
100             Reporter.verbose("Reporter VERBOSE Message #" + i);//NOI18N // +"asdkl slkd aklsdalksdlaksdalksd aslkdalkd alskdalskd aslkdalksd alskda lskla skdlaskd asdalskdalskd alsdia lskd");
101
//rk.crit("Through ReporterImpl");
102
}
103 }
104
105
Popular Tags