KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > logging > LogDomains


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 package com.sun.enterprise.logging;
24
25 import java.util.Hashtable JavaDoc;
26 import java.util.logging.Logger JavaDoc;
27
28 /**
29  * Class LogDomains
30  */

31 public class LogDomains {
32
33     
34     private static final String JavaDoc DOMAIN_ROOT = "javax.enterprise.";
35
36     public static final String JavaDoc AVK_VERIFIER_LOGGER =
37         DOMAIN_ROOT + "system.tools.avk.tools.verifier";
38
39     public static final String JavaDoc AVK_APPVERIFICATION_LOGGER =
40         DOMAIN_ROOT + "system.tools.avk.appverification";
41
42     public static final String JavaDoc AVK_APPVERIFICATION_TOOLS_LOGGER =
43         DOMAIN_ROOT + "system.tools.avk.appverification.tools";
44
45     public static final String JavaDoc AVK_APPVERIFICATION_XML_LOGGER =
46         DOMAIN_ROOT + "system.tools.avk.appverification.xml";
47
48     // RESOURCE_BUNDLES the name of the logging resource bundles.
49

50     private static final String JavaDoc PACKAGE_ROOT = "com.sun.enterprise.";
51
52     private static final String JavaDoc AVK_VERIFIER_BUNDLE =
53         PACKAGE_ROOT + "tools.verifier.LocalStrings";
54
55     // Note that these 3 bundles are packaged only in javke.jar and
56
// they are not present in appserv-rt.jar
57
private static final String JavaDoc AVK_APPVERIFICATION_BUNDLE =
58         PACKAGE_ROOT + "appverification.LocalStrings";
59
60     private static final String JavaDoc AVK_APPVERIFICATION_TOOLS_BUNDLE =
61         PACKAGE_ROOT + "appverification.tools.LocalStrings";
62
63     private static final String JavaDoc AVK_APPVERIFICATION_XML_BUNDLE =
64         PACKAGE_ROOT + "appverification.xml.LocalStrings";
65
66     // static field
67
private static Hashtable JavaDoc<String JavaDoc, Logger JavaDoc> loggers = null;
68
69     // static initializer
70
static {
71       loggers = new Hashtable JavaDoc<String JavaDoc, Logger JavaDoc>();
72       loggers.put(AVK_VERIFIER_LOGGER,
73                   Logger.getLogger(AVK_VERIFIER_LOGGER,
74                                    AVK_VERIFIER_BUNDLE));
75       // When run in instrumentation mode, with javke.jar in classpath
76
// the calls below will succeed
77
try {
78       loggers.put(AVK_APPVERIFICATION_LOGGER,
79                   Logger.getLogger(AVK_APPVERIFICATION_LOGGER,
80                                    AVK_APPVERIFICATION_BUNDLE));
81       loggers.put(AVK_APPVERIFICATION_TOOLS_LOGGER,
82                   Logger.getLogger(AVK_APPVERIFICATION_TOOLS_LOGGER,
83                                    AVK_APPVERIFICATION_TOOLS_BUNDLE));
84       loggers.put(AVK_APPVERIFICATION_XML_LOGGER,
85                   Logger.getLogger(AVK_APPVERIFICATION_XML_LOGGER,
86                                    AVK_APPVERIFICATION_XML_BUNDLE));
87       }catch(Exception JavaDoc e) {
88          // during normal appserver-run, these 3 initializations will fail
89
}
90     }
91
92     private LogDomains() {} // prevent instance creation
93

94     public static Logger JavaDoc getLogger(String JavaDoc name) {
95         return (Logger JavaDoc) loggers.get(name);
96     }
97
98 }
99
Popular Tags