Source Code Cross Referenced for LogUtil.java in  » IDE-Netbeans » visualweb.api.designer » com » sun » rave » web » ui » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » visualweb.api.designer » com.sun.rave.web.ui.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003:         *
0004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005:         *
0006:         * The contents of this file are subject to the terms of either the GNU
0007:         * General Public License Version 2 only ("GPL") or the Common
0008:         * Development and Distribution License("CDDL") (collectively, the
0009:         * "License"). You may not use this file except in compliance with the
0010:         * License. You can obtain a copy of the License at
0011:         * http://www.netbeans.org/cddl-gplv2.html
0012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
0013:         * specific language governing permissions and limitations under the
0014:         * License.  When distributing the software, include this License Header
0015:         * Notice in each file and include the License file at
0016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
0017:         * particular file as subject to the "Classpath" exception as provided
0018:         * by Sun in the GPL Version 2 section of the License file that
0019:         * accompanied this code. If applicable, add the following below the
0020:         * License Header, with the fields enclosed by brackets [] replaced by
0021:         * your own identifying information:
0022:         * "Portions Copyrighted [year] [name of copyright owner]"
0023:         *
0024:         * Contributor(s):
0025:         *
0026:         * The Original Software is NetBeans. The Initial Developer of the Original
0027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
0028:         * Microsystems, Inc. All Rights Reserved.
0029:         *
0030:         * If you wish your version of this file to be governed by only the CDDL
0031:         * or only the GPL Version 2, indicate your decision by adding
0032:         * "[Contributor] elects to include this software in this distribution
0033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
0034:         * single choice of license, a recipient has the option to distribute
0035:         * your version of this file under either the CDDL, the GPL Version 2 or
0036:         * to extend the choice of license to its licensees as provided above.
0037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
0038:         * Version 2 license, then the option applies only if the new code is
0039:         * made subject to such option by the copyright holder.
0040:         */
0041:        package com.sun.rave.web.ui.util;
0042:
0043:        import java.util.logging.Level;
0044:        import java.util.logging.Logger;
0045:
0046:        /**
0047:         *  <p>	This class provides helper methods for logging messages.  It uses
0048:         *	standard J2SE logging.  However, using these API's is abstracts this
0049:         *	away from our code in case we want to go back to Apache commons
0050:         *	logging or some other logging API in the future.</p>
0051:         *
0052:         *  <p> The logging levels follow the J2SE log level names, they are as
0053:         *	follows:</p>
0054:         *
0055:         *	<UL><LI>FINEST	-- Highly detailed tracing message</LI>
0056:         *	    <LI>FINER	-- Fairly detailed tracing message</LI>
0057:         *	    <LI>FINE	-- Coarse tracing message</LI>
0058:         *	    <LI>CONFIG	-- Static configuration messages</LI>
0059:         *	    <LI>INFO	-- Informational messages (logged by default)</LI>
0060:         *	    <LI>WARNING -- Potentially problematic messages</LI>
0061:         *	    <LI>SEVERE	-- Serious failure messages</LI>
0062:         *	</UL>
0063:         *
0064:         *  @author Ken Paulsen (ken.paulsen@sun.com)
0065:         */
0066:        public class LogUtil {
0067:            // FIXME: Check w/ Hemanth to get an "approved" message ID prefix
0068:
0069:            ////////////////////////////////////////////////////////////
0070:            // FINEST LOGGING METHODS
0071:            ////////////////////////////////////////////////////////////
0072:
0073:            /**
0074:             *	<p> Method to check if this log level is enabled for the default
0075:             *	    logger.</p>
0076:             *
0077:             *	@return	true if the log level is enabled, false otherwise.
0078:             */
0079:            public static boolean finestEnabled() {
0080:                return getLogger().isLoggable(Level.FINEST);
0081:            }
0082:
0083:            /**
0084:             *	<p> Method to check if this log level is enabled for the given
0085:             *	    logger.</p>
0086:             *
0087:             *	@param	loggerId    The logger to check.  This may be specified as a
0088:             *			    String or Class Object.
0089:             *
0090:             *	@return	true if the log level is enabled, false otherwise.
0091:             */
0092:            public static boolean finestEnabled(Object loggerId) {
0093:                return getLogger(loggerId).isLoggable(Level.FINEST);
0094:            }
0095:
0096:            /**
0097:             *	<p> Logging method supporting a localized message key and a single
0098:             *	    substitution parameter.  It will use the default Logger.</p>
0099:             *
0100:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0101:             *			    the message.
0102:             *
0103:             *	@param	param	    Value to substitute into the message.
0104:             *
0105:             *	@see LogUtil#BUNDLE_NAME
0106:             */
0107:            public static void finest(String msgId, Object param) {
0108:                finest(msgId, new Object[] { param });
0109:            }
0110:
0111:            /**
0112:             *	<p> Logging method supporting a localized message key and zero or more
0113:             *	    substitution parameters.  It will use the default Logger.</p>
0114:             *
0115:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0116:             *			    the message.
0117:             *
0118:             *	@param	params	    Value(s) to substitute into the message.
0119:             *
0120:             *	@see LogUtil#BUNDLE_NAME
0121:             */
0122:            public static void finest(String msgId, Object params[]) {
0123:                getLogger().log(Level.FINEST, getMessage(msgId, params, false));
0124:            }
0125:
0126:            /**
0127:             *	<p> Logging method supporting a localized message key, a single
0128:             *	    substitution parameter, and the ability to specify the Logger.</p>
0129:             *
0130:             *	@param	loggerId    The logger to use.  This may be specified as a
0131:             *			    String or Class Object.
0132:             *
0133:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0134:             *			    the message.
0135:             *
0136:             *	@param	param	    Value to substitute into the message.
0137:             *
0138:             *	@see LogUtil#BUNDLE_NAME
0139:             */
0140:            public static void finest(Object loggerId, String msgId,
0141:                    Object param) {
0142:                finest(loggerId, msgId, new Object[] { param });
0143:            }
0144:
0145:            /**
0146:             *	<p> Logging method supporting a localized message key, zero or more
0147:             *	    substitution parameters, and the ability to specify the Logger.</p>
0148:             *
0149:             *	@param	loggerId    The logger to use.  This may be specified as a
0150:             *			    String or Class Object.
0151:             *
0152:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0153:             *			    the message.
0154:             *
0155:             *	@param	params	    Value(s) to substitute into the message.
0156:             *
0157:             *	@see LogUtil#BUNDLE_NAME
0158:             */
0159:            public static void finest(Object loggerId, String msgId,
0160:                    Object params[]) {
0161:                getLogger(loggerId).log(Level.FINEST,
0162:                        getMessage(msgId, params, false));
0163:            }
0164:
0165:            /**
0166:             *	<p> Logging method to log a simple localized or non-localized message.
0167:             *	    This method will first attempt to find <code>msg</code> in the
0168:             *	    properties file, if not found it will print the given msg.</p>
0169:             *
0170:             *	@param	msg	    The message (or <code>ResourceBundle</code> key).
0171:             */
0172:            public static void finest(String msg) {
0173:                finest(DEFAULT_LOGGER, msg);
0174:            }
0175:
0176:            /**
0177:             *	<p> Logging method to log a simple localized or non-localized message.
0178:             *	    This method will first attempt to find <code>msg</code> in the
0179:             *	    properties file, if not found it will print the given msg.  The
0180:             *	    specified Logger will be used.</p>
0181:             *
0182:             *	@param	loggerId    The logger to use.  This may be specified as a
0183:             *			    String or Class Object.
0184:             *
0185:             *	@param	msg	    The message (or <code>ResourceBundle</code> key).
0186:             */
0187:            public static void finest(Object loggerId, String msg) {
0188:                getLogger(loggerId).log(Level.FINEST, getMessage(msg, false));
0189:            }
0190:
0191:            /**
0192:             *	<p> Logging method to log a <code>Throwable</code> with a
0193:             *	    message.</p>
0194:             *
0195:             *	@param	msg	    The message.
0196:             *
0197:             *	@param	ex	    The <code>Throwable</code> to log.
0198:             */
0199:            public static void finest(String msg, Throwable ex) {
0200:                getLogger().log(Level.FINEST,
0201:                        DEFAULT_LOG_KEY + LOG_KEY_MESSAGE_SEPARATOR + msg, ex);
0202:            }
0203:
0204:            /**
0205:             *	<p> Logging method to log a <code>Throwable</code> with a
0206:             *	    message.  The specified Logger will be used.</p>
0207:             *
0208:             *	@param	loggerId    The logger to use.  This may be specified as a
0209:             *			    String or Class Object.
0210:             *
0211:             *	@param	msg	    The message.
0212:             *
0213:             *	@param	ex	    The <code>Throwable</code> to log.
0214:             */
0215:            public static void finest(Object loggerId, String msg, Throwable ex) {
0216:                getLogger(loggerId).log(Level.FINEST,
0217:                        DEFAULT_LOG_KEY + LOG_KEY_MESSAGE_SEPARATOR + msg, ex);
0218:            }
0219:
0220:            ////////////////////////////////////////////////////////////
0221:            // FINER LOGGING METHODS
0222:            ////////////////////////////////////////////////////////////
0223:
0224:            /**
0225:             *	<p> Method to check if this log level is enabled for the default
0226:             *	    logger.</p>
0227:             *
0228:             *	@return	true if the log level is enabled, false otherwise.
0229:             */
0230:            public static boolean finerEnabled() {
0231:                return getLogger().isLoggable(Level.FINER);
0232:            }
0233:
0234:            /**
0235:             *	<p> Method to check if this log level is enabled for the given
0236:             *	    logger.</p>
0237:             *
0238:             *	@param	loggerId    The logger to check.  This may be specified as a
0239:             *			    String or Class Object.
0240:             *
0241:             *	@return	true if the log level is enabled, false otherwise.
0242:             */
0243:            public static boolean finerEnabled(Object loggerId) {
0244:                return getLogger(loggerId).isLoggable(Level.FINER);
0245:            }
0246:
0247:            /**
0248:             *	<p> Logging method supporting a localized message key and a single
0249:             *	    substitution parameter.  It will use the default Logger.</p>
0250:             *
0251:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0252:             *			    the message.
0253:             *
0254:             *	@param	param	    Value to substitute into the message.
0255:             *
0256:             *	@see LogUtil#BUNDLE_NAME
0257:             */
0258:            public static void finer(String msgId, Object param) {
0259:                finer(msgId, new Object[] { param });
0260:            }
0261:
0262:            /**
0263:             *	<p> Logging method supporting a localized message key and zero or more
0264:             *	    substitution parameters.  It will use the default Logger.</p>
0265:             *
0266:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0267:             *			    the message.
0268:             *
0269:             *	@param	params	    Value(s) to substitute into the message.
0270:             *
0271:             *	@see LogUtil#BUNDLE_NAME
0272:             */
0273:            public static void finer(String msgId, Object params[]) {
0274:                getLogger().log(Level.FINER, getMessage(msgId, params, false));
0275:            }
0276:
0277:            /**
0278:             *	<p> Logging method supporting a localized message key, a single
0279:             *	    substitution parameter, and the ability to specify the Logger.</p>
0280:             *
0281:             *	@param	loggerId    The logger to use.  This may be specified as a
0282:             *			    String or Class Object.
0283:             *
0284:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0285:             *			    the message.
0286:             *
0287:             *	@param	param	    Value to substitute into the message.
0288:             *
0289:             *	@see LogUtil#BUNDLE_NAME
0290:             */
0291:            public static void finer(Object loggerId, String msgId, Object param) {
0292:                finer(loggerId, msgId, new Object[] { param });
0293:            }
0294:
0295:            /**
0296:             *	<p> Logging method supporting a localized message key, zero or more
0297:             *	    substitution parameters, and the ability to specify the Logger.</p>
0298:             *
0299:             *	@param	loggerId    The logger to use.  This may be specified as a
0300:             *			    String or Class Object.
0301:             *
0302:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0303:             *			    the message.
0304:             *
0305:             *	@param	params	    Value(s) to substitute into the message.
0306:             *
0307:             *	@see LogUtil#BUNDLE_NAME
0308:             */
0309:            public static void finer(Object loggerId, String msgId,
0310:                    Object params[]) {
0311:                getLogger(loggerId).log(Level.FINER,
0312:                        getMessage(msgId, params, false));
0313:            }
0314:
0315:            /**
0316:             *	<p> Logging method to log a simple localized or non-localized message.
0317:             *	    This method will first attempt to find <code>msg</code> in the
0318:             *	    properties file, if not found it will print the given msg.</p>
0319:             *
0320:             *	@param	msg	    The message (or <code>ResourceBundle</code> key).
0321:             */
0322:            public static void finer(String msg) {
0323:                finer(DEFAULT_LOGGER, msg);
0324:            }
0325:
0326:            /**
0327:             *	<p> Logging method to log a simple localized or non-localized message.
0328:             *	    This method will first attempt to find <code>msg</code> in the
0329:             *	    properties file, if not found it will print the given msg.  The
0330:             *	    specified Logger will be used.</p>
0331:             *
0332:             *	@param	loggerId    The logger to use.  This may be specified as a
0333:             *			    String or Class Object.
0334:             *
0335:             *	@param	msg	    The message (or <code>ResourceBundle</code> key).
0336:             */
0337:            public static void finer(Object loggerId, String msg) {
0338:                getLogger(loggerId).log(Level.FINER, getMessage(msg, false));
0339:            }
0340:
0341:            /**
0342:             *	<p> Logging method to log a <code>Throwable</code> with a
0343:             *	    message.</p>
0344:             *
0345:             *	@param	msg	    The message.
0346:             *
0347:             *	@param	ex	    The <code>Throwable</code> to log.
0348:             */
0349:            public static void finer(String msg, Throwable ex) {
0350:                getLogger().log(Level.FINER,
0351:                        DEFAULT_LOG_KEY + LOG_KEY_MESSAGE_SEPARATOR + msg, ex);
0352:            }
0353:
0354:            /**
0355:             *	<p> Logging method to log a <code>Throwable</code> with a
0356:             *	    message.  The specified Logger will be used.</p>
0357:             *
0358:             *	@param	loggerId    The logger to use.  This may be specified as a
0359:             *			    String or Class Object.
0360:             *
0361:             *	@param	msg	    The message.
0362:             *
0363:             *	@param	ex	    The <code>Throwable</code> to log.
0364:             */
0365:            public static void finer(Object loggerId, String msg, Throwable ex) {
0366:                getLogger(loggerId).log(Level.FINER,
0367:                        DEFAULT_LOG_KEY + LOG_KEY_MESSAGE_SEPARATOR + msg, ex);
0368:            }
0369:
0370:            ////////////////////////////////////////////////////////////
0371:            // FINE LOGGING METHODS
0372:            ////////////////////////////////////////////////////////////
0373:
0374:            /**
0375:             *	<p> Method to check if this log level is enabled for the default
0376:             *	    logger.</p>
0377:             *
0378:             *	@return	true if the log level is enabled, false otherwise.
0379:             */
0380:            public static boolean fineEnabled() {
0381:                return getLogger().isLoggable(Level.FINE);
0382:            }
0383:
0384:            /**
0385:             *	<p> Method to check if this log level is enabled for the given
0386:             *	    logger.</p>
0387:             *
0388:             *	@param	loggerId    The logger to check.  This may be specified as a
0389:             *			    String or Class Object.
0390:             *
0391:             *	@return	true if the log level is enabled, false otherwise.
0392:             */
0393:            public static boolean fineEnabled(Object loggerId) {
0394:                return getLogger(loggerId).isLoggable(Level.FINE);
0395:            }
0396:
0397:            /**
0398:             *	<p> Logging method supporting a localized message key and a single
0399:             *	    substitution parameter.  It will use the default Logger.</p>
0400:             *
0401:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0402:             *			    the message.
0403:             *
0404:             *	@param	param	    Value to substitute into the message.
0405:             *
0406:             *	@see LogUtil#BUNDLE_NAME
0407:             */
0408:            public static void fine(String msgId, Object param) {
0409:                fine(msgId, new Object[] { param });
0410:            }
0411:
0412:            /**
0413:             *	<p> Logging method supporting a localized message key and zero or more
0414:             *	    substitution parameters.  It will use the default Logger.</p>
0415:             *
0416:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0417:             *			    the message.
0418:             *
0419:             *	@param	params	    Value(s) to substitute into the message.
0420:             *
0421:             *	@see LogUtil#BUNDLE_NAME
0422:             */
0423:            public static void fine(String msgId, Object params[]) {
0424:                getLogger().log(Level.FINE, getMessage(msgId, params, false));
0425:            }
0426:
0427:            /**
0428:             *	<p> Logging method supporting a localized message key, a single
0429:             *	    substitution parameter, and the ability to specify the Logger.</p>
0430:             *
0431:             *	@param	loggerId    The logger to use.  This may be specified as a
0432:             *			    String or Class Object.
0433:             *
0434:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0435:             *			    the message.
0436:             *
0437:             *	@param	param	    Value to substitute into the message.
0438:             *
0439:             *	@see LogUtil#BUNDLE_NAME
0440:             */
0441:            public static void fine(Object loggerId, String msgId, Object param) {
0442:                fine(loggerId, msgId, new Object[] { param });
0443:            }
0444:
0445:            /**
0446:             *	<p> Logging method supporting a localized message key, zero or more
0447:             *	    substitution parameters, and the ability to specify the Logger.</p>
0448:             *
0449:             *	@param	loggerId    The logger to use.  This may be specified as a
0450:             *			    String or Class Object.
0451:             *
0452:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0453:             *			    the message.
0454:             *
0455:             *	@param	params	    Value(s) to substitute into the message.
0456:             *
0457:             *	@see LogUtil#BUNDLE_NAME
0458:             */
0459:            public static void fine(Object loggerId, String msgId,
0460:                    Object params[]) {
0461:                getLogger(loggerId).log(Level.FINE,
0462:                        getMessage(msgId, params, false));
0463:            }
0464:
0465:            /**
0466:             *	<p> Logging method to log a simple localized or non-localized message.
0467:             *	    This method will first attempt to find <code>msg</code> in the
0468:             *	    properties file, if not found it will print the given msg.</p>
0469:             *
0470:             *	@param	msg	    The message (or <code>ResourceBundle</code> key).
0471:             */
0472:            public static void fine(String msg) {
0473:                fine(DEFAULT_LOGGER, msg);
0474:            }
0475:
0476:            /**
0477:             *	<p> Logging method to log a simple localized or non-localized message.
0478:             *	    This method will first attempt to find <code>msg</code> in the
0479:             *	    properties file, if not found it will print the given msg.  The
0480:             *	    specified Logger will be used.</p>
0481:             *
0482:             *	@param	loggerId    The logger to use.  This may be specified as a
0483:             *			    String or Class Object.
0484:             *
0485:             *	@param	msg	    The message (or <code>ResourceBundle</code> key).
0486:             */
0487:            public static void fine(Object loggerId, String msg) {
0488:                getLogger(loggerId).log(Level.FINE, getMessage(msg, false));
0489:            }
0490:
0491:            /**
0492:             *	<p> Logging method to log a <code>Throwable</code> with a message.</p>
0493:             *
0494:             *	@param	msg	    The message.
0495:             *
0496:             *	@param	ex	    The <code>Throwable</code> to log.
0497:             */
0498:            public static void fine(String msg, Throwable ex) {
0499:                getLogger().log(Level.FINE, getMessage(msg, false), ex);
0500:            }
0501:
0502:            /**
0503:             *	<p> Logging method to log a <code>Throwable</code> with a
0504:             *	    message.  The specified Logger will be used.</p>
0505:             *
0506:             *	@param	loggerId    The logger to use.  This may be specified as a
0507:             *			    String or Class Object.
0508:             *
0509:             *	@param	msg	    The message.
0510:             *
0511:             *	@param	ex	    The <code>Throwable</code> to log.
0512:             */
0513:            public static void fine(Object loggerId, String msg, Throwable ex) {
0514:                getLogger(loggerId).log(Level.FINE, getMessage(msg, false), ex);
0515:            }
0516:
0517:            ////////////////////////////////////////////////////////////
0518:            // CONFIG LOGGING METHODS
0519:            ////////////////////////////////////////////////////////////
0520:
0521:            /**
0522:             *	<p> Method to check if this log level is enabled for the default
0523:             *	    logger.</p>
0524:             *
0525:             *	@return	true if the log level is enabled, false otherwise.
0526:             */
0527:            public static boolean configEnabled() {
0528:                return getLogger().isLoggable(Level.CONFIG);
0529:            }
0530:
0531:            /**
0532:             *	<p> Method to check if this log level is enabled for the given
0533:             *	    logger.</p>
0534:             *
0535:             *	@param	loggerId    The logger to check.  This may be specified as a
0536:             *			    String or Class Object.
0537:             *
0538:             *	@return	true if the log level is enabled, false otherwise.
0539:             */
0540:            public static boolean configEnabled(Object loggerId) {
0541:                return getLogger(loggerId).isLoggable(Level.CONFIG);
0542:            }
0543:
0544:            /**
0545:             *	<p> Logging method supporting a localized message key and a single
0546:             *	    substitution parameter.  It will use the default Logger.</p>
0547:             *
0548:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0549:             *			    the message.
0550:             *
0551:             *	@param	param	    Value to substitute into the message.
0552:             *
0553:             *	@see LogUtil#BUNDLE_NAME
0554:             */
0555:            public static void config(String msgId, Object param) {
0556:                config(msgId, new Object[] { param });
0557:            }
0558:
0559:            /**
0560:             *	<p> Logging method supporting a localized message key and zero or more
0561:             *	    substitution parameters.  It will use the default Logger.</p>
0562:             *
0563:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0564:             *			    the message.
0565:             *
0566:             *	@param	params	    Value(s) to substitute into the message.
0567:             *
0568:             *	@see LogUtil#BUNDLE_NAME
0569:             */
0570:            public static void config(String msgId, Object params[]) {
0571:                getLogger().log(Level.CONFIG, getMessage(msgId, params, false));
0572:            }
0573:
0574:            /**
0575:             *	<p> Logging method supporting a localized message key, a single
0576:             *	    substitution parameter, and the ability to specify the Logger.</p>
0577:             *
0578:             *	@param	loggerId    The logger to use.  This may be specified as a
0579:             *			    String or Class Object.
0580:             *
0581:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0582:             *			    the message.
0583:             *
0584:             *	@param	param	    Value to substitute into the message.
0585:             *
0586:             *	@see LogUtil#BUNDLE_NAME
0587:             */
0588:            public static void config(Object loggerId, String msgId,
0589:                    Object param) {
0590:                config(loggerId, msgId, new Object[] { param });
0591:            }
0592:
0593:            /**
0594:             *	<p> Logging method supporting a localized message key, zero or more
0595:             *	    substitution parameters, and the ability to specify the Logger.</p>
0596:             *
0597:             *	@param	loggerId    The logger to use.  This may be specified as a
0598:             *			    String or Class Object.
0599:             *
0600:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0601:             *			    the message.
0602:             *
0603:             *	@param	params	    Value(s) to substitute into the message.
0604:             *
0605:             *	@see LogUtil#BUNDLE_NAME
0606:             */
0607:            public static void config(Object loggerId, String msgId,
0608:                    Object params[]) {
0609:                getLogger(loggerId).log(Level.CONFIG,
0610:                        getMessage(msgId, params, false));
0611:            }
0612:
0613:            /**
0614:             *	<p> Logging method to log a simple localized or non-localized message.
0615:             *	    This method will first attempt to find <code>msg</code> in the
0616:             *	    properties file, if not found it will print the given msg.</p>
0617:             *
0618:             *	@param	msg	    The message (or <code>ResourceBundle</code> key).
0619:             */
0620:            public static void config(String msg) {
0621:                config(DEFAULT_LOGGER, msg);
0622:            }
0623:
0624:            /**
0625:             *	<p> Logging method to log a simple localized or non-localized message.
0626:             *	    This method will first attempt to find <code>msg</code> in the
0627:             *	    properties file, if not found it will print the given msg.  The
0628:             *	    specified Logger will be used.</p>
0629:             *
0630:             *	@param	loggerId    The logger to use.  This may be specified as a
0631:             *			    String or Class Object.
0632:             *
0633:             *	@param	msg	    The message (or <code>ResourceBundle</code> key).
0634:             */
0635:            public static void config(Object loggerId, String msg) {
0636:                getLogger(loggerId).log(Level.CONFIG, getMessage(msg, false));
0637:            }
0638:
0639:            /**
0640:             *	<p> Logging method to log a <code>Throwable</code> with a
0641:             *	    message.</p>
0642:             *
0643:             *	@param	msg	    The message.
0644:             *
0645:             *	@param	ex	    The <code>Throwable</code> to log.
0646:             */
0647:            public static void config(String msg, Throwable ex) {
0648:                getLogger().log(Level.CONFIG, getMessage(msg, false), ex);
0649:            }
0650:
0651:            /**
0652:             *	<p> Logging method to log a <code>Throwable</code> with a
0653:             *	    message.  The specified Logger will be used.</p>
0654:             *
0655:             *	@param	loggerId    The logger to use.  This may be specified as a
0656:             *			    String or Class Object.
0657:             *
0658:             *	@param	msg	    The message.
0659:             *
0660:             *	@param	ex	    The <code>Throwable</code> to log.
0661:             */
0662:            public static void config(Object loggerId, String msg, Throwable ex) {
0663:                getLogger(loggerId).log(Level.CONFIG, getMessage(msg, false),
0664:                        ex);
0665:            }
0666:
0667:            ////////////////////////////////////////////////////////////
0668:            // INFO LOGGING METHODS
0669:            ////////////////////////////////////////////////////////////
0670:
0671:            /**
0672:             *	<p> Method to check if this log level is enabled for the default
0673:             *	    logger.</p>
0674:             *
0675:             *	@return	true if the log level is enabled, false otherwise.
0676:             */
0677:            public static boolean infoEnabled() {
0678:                return getLogger().isLoggable(Level.INFO);
0679:            }
0680:
0681:            /**
0682:             *	<p> Method to check if this log level is enabled for the given
0683:             *	    logger.</p>
0684:             *
0685:             *	@param	loggerId    The logger to check.  This may be specified as a
0686:             *			    String or Class Object.
0687:             *
0688:             *	@return	true if the log level is enabled, false otherwise.
0689:             */
0690:            public static boolean infoEnabled(Object loggerId) {
0691:                return getLogger(loggerId).isLoggable(Level.INFO);
0692:            }
0693:
0694:            /**
0695:             *	<p> Logging method to log a simple localized message.  The default
0696:             *	    Logger will be used.</p>
0697:             *
0698:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0699:             *			    the message.
0700:             *
0701:             *	@see LogUtil#BUNDLE_NAME
0702:             */
0703:            public static void info(String msgId) {
0704:                getLogger().log(Level.INFO, getMessage(msgId, true));
0705:            }
0706:
0707:            /**
0708:             *	<p> Logging method to log a simple localized message.  The
0709:             *	    specified Logger will be used.</p>
0710:             *
0711:             *	@param	loggerId    The logger to use.  This may be specified as a
0712:             *			    String or Class Object.
0713:             *
0714:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0715:             *			    the message.
0716:             *
0717:             *	@see LogUtil#BUNDLE_NAME
0718:             */
0719:            public static void info(Object loggerId, String msgId) {
0720:                getLogger(loggerId).log(Level.INFO, getMessage(msgId, true));
0721:            }
0722:
0723:            /**
0724:             *	<p> Logging method supporting a localized message key and a single
0725:             *	    substitution parameter.  It will use the default Logger.</p>
0726:             *
0727:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0728:             *			    the message.
0729:             *
0730:             *	@param	param	    Value to substitute into the message.
0731:             *
0732:             *	@see LogUtil#BUNDLE_NAME
0733:             */
0734:            public static void info(String msgId, Object param) {
0735:                info(msgId, new Object[] { param });
0736:            }
0737:
0738:            /**
0739:             *	<p> Logging method supporting a localized message key and zero or more
0740:             *	    substitution parameters.  It will use the default Logger.</p>
0741:             *
0742:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0743:             *			    the message.
0744:             *
0745:             *	@param	params	    Value(s) to substitute into the message.
0746:             *
0747:             *	@see LogUtil#BUNDLE_NAME
0748:             */
0749:            public static void info(String msgId, Object params[]) {
0750:                getLogger().log(Level.INFO, getMessage(msgId, params, true));
0751:            }
0752:
0753:            /**
0754:             *	<p> Logging method supporting a localized message key, a single
0755:             *	    substitution parameter, and the ability to specify the Logger.</p>
0756:             *
0757:             *	@param	loggerId    The logger to use.  This may be specified as a
0758:             *			    String or Class Object.
0759:             *
0760:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0761:             *			    the message.
0762:             *
0763:             *	@param	param	    Value to substitute into the message.
0764:             *
0765:             *	@see LogUtil#BUNDLE_NAME
0766:             */
0767:            public static void info(Object loggerId, String msgId, Object param) {
0768:                info(loggerId, msgId, new Object[] { param });
0769:            }
0770:
0771:            /**
0772:             *	<p> Logging method supporting a localized message key, zero or more
0773:             *	    substitution parameters, and the ability to specify the Logger.</p>
0774:             *
0775:             *	@param	loggerId    The logger to use.  This may be specified as a
0776:             *			    String or Class Object.
0777:             *
0778:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0779:             *			    the message.
0780:             *
0781:             *	@param	params	    Value(s) to substitute into the message.
0782:             *
0783:             *	@see LogUtil#BUNDLE_NAME
0784:             */
0785:            public static void info(Object loggerId, String msgId,
0786:                    Object params[]) {
0787:                getLogger(loggerId).log(Level.INFO,
0788:                        getMessage(msgId, params, true));
0789:            }
0790:
0791:            /**
0792:             *	<p> Logging method to log a <code>Throwable</code> with a localized
0793:             *	    message.</p>
0794:             *
0795:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0796:             *			    the message.
0797:             *
0798:             *	@param	ex	    The <code>Throwable</code> to log.
0799:             *
0800:             *	@see LogUtil#BUNDLE_NAME
0801:             */
0802:            public static void info(String msgId, Throwable ex) {
0803:                getLogger().log(Level.INFO, getMessage(msgId, false), ex);
0804:            }
0805:
0806:            /**
0807:             *	<p> Logging method to log a <code>Throwable</code> with a localized
0808:             *	    message.  The specified Logger will be used.</p>
0809:             *
0810:             *	@param	loggerId    The logger to use.  This may be specified as a
0811:             *			    String or Class Object.
0812:             *
0813:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0814:             *			    the message.
0815:             *
0816:             *	@param	ex	    The <code>Throwable</code> to log.
0817:             *
0818:             *	@see LogUtil#BUNDLE_NAME
0819:             */
0820:            public static void info(Object loggerId, String msgId, Throwable ex) {
0821:                getLogger(loggerId).log(Level.INFO, getMessage(msgId, false),
0822:                        ex);
0823:            }
0824:
0825:            ////////////////////////////////////////////////////////////
0826:            // WARNING LOGGING METHODS
0827:            ////////////////////////////////////////////////////////////
0828:
0829:            /**
0830:             *	<p> Method to check if this log level is enabled for the default
0831:             *	    logger.</p>
0832:             *
0833:             *	@return	true if the log level is enabled, false otherwise.
0834:             */
0835:            public static boolean warningEnabled() {
0836:                return getLogger().isLoggable(Level.WARNING);
0837:            }
0838:
0839:            /**
0840:             *	<p> Method to check if this log level is enabled for the given
0841:             *	    logger.</p>
0842:             *
0843:             *	@param	loggerId    The logger to check.  This may be specified as a
0844:             *			    String or Class Object.
0845:             *
0846:             *	@return	true if the log level is enabled, false otherwise.
0847:             */
0848:            public static boolean warningEnabled(Object loggerId) {
0849:                return getLogger(loggerId).isLoggable(Level.WARNING);
0850:            }
0851:
0852:            /**
0853:             *	<p> Logging method to log a simple localized message.  The default
0854:             *	    Logger will be used.</p>
0855:             *
0856:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0857:             *			    the message.
0858:             *
0859:             *	@see LogUtil#BUNDLE_NAME
0860:             */
0861:            public static void warning(String msgId) {
0862:                getLogger().log(Level.WARNING, getMessage(msgId, true));
0863:            }
0864:
0865:            /**
0866:             *	<p> Logging method to log a simple localized message.  The
0867:             *	    specified Logger will be used.</p>
0868:             *
0869:             *	@param	loggerId    The logger to use.  This may be specified as a
0870:             *			    String or Class Object.
0871:             *
0872:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0873:             *			    the message.
0874:             *
0875:             *	@see LogUtil#BUNDLE_NAME
0876:             */
0877:            public static void warning(Object loggerId, String msgId) {
0878:                getLogger(loggerId).log(Level.WARNING, getMessage(msgId, true));
0879:            }
0880:
0881:            /**
0882:             *	<p> Logging method supporting a localized message key and a single
0883:             *	    substitution parameter.  It will use the default Logger.</p>
0884:             *
0885:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0886:             *			    the message.
0887:             *
0888:             *	@param	param	    Value to substitute into the message.
0889:             *
0890:             *	@see LogUtil#BUNDLE_NAME
0891:             */
0892:            public static void warning(String msgId, Object param) {
0893:                warning(msgId, new Object[] { param });
0894:            }
0895:
0896:            /**
0897:             *	<p> Logging method supporting a localized message key and zero or more
0898:             *	    substitution parameters.  It will use the default Logger.</p>
0899:             *
0900:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0901:             *			    the message.
0902:             *
0903:             *	@param	params	    Value(s) to substitute into the message.
0904:             *
0905:             *	@see LogUtil#BUNDLE_NAME
0906:             */
0907:            public static void warning(String msgId, Object params[]) {
0908:                getLogger().log(Level.WARNING, getMessage(msgId, params, true));
0909:            }
0910:
0911:            /**
0912:             *	<p> Logging method supporting a localized message key, a single
0913:             *	    substitution parameter, and the ability to specify the Logger.</p>
0914:             *
0915:             *	@param	loggerId    The logger to use.  This may be specified as a
0916:             *			    String or Class Object.
0917:             *
0918:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0919:             *			    the message.
0920:             *
0921:             *	@param	param	    Value to substitute into the message.
0922:             *
0923:             *	@see LogUtil#BUNDLE_NAME
0924:             */
0925:            public static void warning(Object loggerId, String msgId,
0926:                    Object param) {
0927:                warning(loggerId, msgId, new Object[] { param });
0928:            }
0929:
0930:            /**
0931:             *	<p> Logging method supporting a localized message key, zero or more
0932:             *	    substitution parameters, and the ability to specify the Logger.</p>
0933:             *
0934:             *	@param	loggerId    The logger to use.  This may be specified as a
0935:             *			    String or Class Object.
0936:             *
0937:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0938:             *			    the message.
0939:             *
0940:             *	@param	params	    Value(s) to substitute into the message.
0941:             *
0942:             *	@see LogUtil#BUNDLE_NAME
0943:             */
0944:            public static void warning(Object loggerId, String msgId,
0945:                    Object params[]) {
0946:                getLogger(loggerId).log(Level.WARNING,
0947:                        getMessage(msgId, params, true));
0948:            }
0949:
0950:            /**
0951:             *	<p> Logging method to log a <code>Throwable</code> with a localized
0952:             *	    message.</p>
0953:             *
0954:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0955:             *			    the message.
0956:             *
0957:             *	@param	ex	    The <code>Throwable</code> to log.
0958:             *
0959:             *	@see LogUtil#BUNDLE_NAME
0960:             */
0961:            public static void warning(String msgId, Throwable ex) {
0962:                getLogger().log(Level.WARNING, getMessage(msgId, false), ex);
0963:            }
0964:
0965:            /**
0966:             *	<p> Logging method to log a <code>Throwable</code> with a localized
0967:             *	    message.  The specified Logger will be used.</p>
0968:             *
0969:             *	@param	loggerId    The logger to use.  This may be specified as a
0970:             *			    String or Class Object.
0971:             *
0972:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
0973:             *			    the message.
0974:             *
0975:             *	@param	ex	    The <code>Throwable</code> to log.
0976:             *
0977:             *	@see LogUtil#BUNDLE_NAME
0978:             */
0979:            public static void warning(Object loggerId, String msgId,
0980:                    Throwable ex) {
0981:                getLogger(loggerId).log(Level.WARNING,
0982:                        getMessage(msgId, false), ex);
0983:            }
0984:
0985:            ////////////////////////////////////////////////////////////
0986:            // SEVERE LOGGING METHODS
0987:            ////////////////////////////////////////////////////////////
0988:
0989:            /**
0990:             *	<p> Method to check if this log level is enabled for the default
0991:             *	    logger.</p>
0992:             *
0993:             *	@return	true if the log level is enabled, false otherwise.
0994:             */
0995:            public static boolean severeEnabled() {
0996:                return getLogger().isLoggable(Level.SEVERE);
0997:            }
0998:
0999:            /**
1000:             *	<p> Method to check if this log level is enabled for the given
1001:             *	    logger.</p>
1002:             *
1003:             *	@param	loggerId    The logger to check.  This may be specified as a
1004:             *			    String or Class Object.
1005:             *
1006:             *	@return	true if the log level is enabled, false otherwise.
1007:             */
1008:            public static boolean severeEnabled(Object loggerId) {
1009:                return getLogger(loggerId).isLoggable(Level.SEVERE);
1010:            }
1011:
1012:            /**
1013:             *	<p> Logging method to log a simple localized message.  The default
1014:             *	    Logger will be used.</p>
1015:             *
1016:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
1017:             *			    the message.
1018:             *
1019:             *	@see LogUtil#BUNDLE_NAME
1020:             */
1021:            public static void severe(String msgId) {
1022:                getLogger().log(Level.SEVERE, getMessage(msgId, true));
1023:            }
1024:
1025:            /**
1026:             *	<p> Logging method to log a simple localized message.  The
1027:             *	    specified Logger will be used.</p>
1028:             *
1029:             *	@param	loggerId    The logger to use.  This may be specified as a
1030:             *			    String or Class Object.
1031:             *
1032:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
1033:             *			    the message.
1034:             *
1035:             *	@see LogUtil#BUNDLE_NAME
1036:             */
1037:            public static void severe(Object loggerId, String msgId) {
1038:                getLogger(loggerId).log(Level.SEVERE, getMessage(msgId, true));
1039:            }
1040:
1041:            /**
1042:             *	<p> Logging method supporting a localized message key and a single
1043:             *	    substitution parameter.  It will use the default Logger.</p>
1044:             *
1045:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
1046:             *			    the message.
1047:             *
1048:             *	@param	param	    Value to substitute into the message.
1049:             *
1050:             *	@see LogUtil#BUNDLE_NAME
1051:             */
1052:            public static void severe(String msgId, Object param) {
1053:                severe(msgId, new Object[] { param });
1054:            }
1055:
1056:            /**
1057:             *	<p> Logging method supporting a localized message key and zero or more
1058:             *	    substitution parameters.  It will use the default Logger.</p>
1059:             *
1060:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
1061:             *			    the message.
1062:             *
1063:             *	@param	params	    Value(s) to substitute into the message.
1064:             *
1065:             *	@see LogUtil#BUNDLE_NAME
1066:             */
1067:            public static void severe(String msgId, Object params[]) {
1068:                getLogger().log(Level.SEVERE, getMessage(msgId, params, true));
1069:            }
1070:
1071:            /**
1072:             *	<p> Logging method supporting a localized message key, a single
1073:             *	    substitution parameter, and the ability to specify the Logger.</p>
1074:             *
1075:             *	@param	loggerId    The logger to use.  This may be specified as a
1076:             *			    String or Class Object.
1077:             *
1078:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
1079:             *			    the message.
1080:             *
1081:             *	@param	param	    Value to substitute into the message.
1082:             *
1083:             *	@see LogUtil#BUNDLE_NAME
1084:             */
1085:            public static void severe(Object loggerId, String msgId,
1086:                    Object param) {
1087:                severe(loggerId, msgId, new Object[] { param });
1088:            }
1089:
1090:            /**
1091:             *	<p> Logging method supporting a localized message key, zero or more
1092:             *	    substitution parameters, and the ability to specify the Logger.</p>
1093:             *
1094:             *	@param	loggerId    The logger to use.  This may be specified as a
1095:             *			    String or Class Object.
1096:             *
1097:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
1098:             *			    the message.
1099:             *
1100:             *	@param	params	    Value(s) to substitute into the message.
1101:             *
1102:             *	@see LogUtil#BUNDLE_NAME
1103:             */
1104:            public static void severe(Object loggerId, String msgId,
1105:                    Object params[]) {
1106:                getLogger(loggerId).log(Level.SEVERE,
1107:                        getMessage(msgId, params, true));
1108:            }
1109:
1110:            /**
1111:             *	<p> Logging method to log a <code>Throwable</code> with a localized
1112:             *	    message.</p>
1113:             *
1114:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
1115:             *			    the message.
1116:             *
1117:             *	@param	ex	    The <code>Throwable</code> to log.
1118:             *
1119:             *	@see LogUtil#BUNDLE_NAME
1120:             */
1121:            public static void severe(String msgId, Throwable ex) {
1122:                getLogger().log(Level.SEVERE, getMessage(msgId, false), ex);
1123:            }
1124:
1125:            /**
1126:             *	<p> Logging method to log a <code>Throwable</code> with a localized
1127:             *	    message.  The specified Logger will be used.</p>
1128:             *
1129:             *	@param	loggerId    The logger to use.  This may be specified as a
1130:             *			    String or Class Object.
1131:             *
1132:             *	@param	msgId	    The <code>ResourceBundle</code> key used to lookup
1133:             *			    the message.
1134:             *
1135:             *	@param	ex	    The <code>Throwable</code> to log.
1136:             *
1137:             *	@see LogUtil#BUNDLE_NAME
1138:             */
1139:            public static void severe(Object loggerId, String msgId,
1140:                    Throwable ex) {
1141:                getLogger(loggerId).log(Level.SEVERE, getMessage(msgId, false),
1142:                        ex);
1143:            }
1144:
1145:            ////////////////////////////////////////////////////////////
1146:            // Misc methods
1147:            ////////////////////////////////////////////////////////////
1148:
1149:            /**
1150:             *	<p> This method provides direct access to the default Logger.  It is
1151:             *	    private because the internals of what type of logger is being used
1152:             *	    should not be exposed outside this class.</p>
1153:             */
1154:            private static Logger getLogger() {
1155:                return DEFAULT_LOGGER;
1156:            }
1157:
1158:            /**
1159:             *	<p> This method provides direct access to the Logger.  It is private
1160:             *	    because the internals of what type of logger is being used should
1161:             *	    not be exposed outside this class.</p>
1162:             *
1163:             *	<p> This method will return the default logger (if INFO), or delegate
1164:             *	    to {@link getLogger(String)} or {@link getLogger(Class)}.</p>
1165:             *
1166:             *	@param	key	The logger to use as specified by the Object.
1167:             */
1168:            private static Logger getLogger(Object key) {
1169:                // If null, use default
1170:                if (key == null) {
1171:                    return getLogger();
1172:                }
1173:
1174:                // If string, use it as logger name
1175:                if (key instanceof  String) {
1176:                    return getLogger((String) key);
1177:                }
1178:
1179:                // If Log, return it
1180:                if (key instanceof  Logger) {
1181:                    return (Logger) key;
1182:                }
1183:
1184:                // If class, use it
1185:                if (key instanceof  Class) {
1186:                    return getLogger((Class) key);
1187:                }
1188:
1189:                // else, use the class name
1190:                return getLogger(key.getClass());
1191:            }
1192:
1193:            /**
1194:             *	<p> This method provides direct access to the Logger.  It is private
1195:             *	    because the internals of what type of logger is being used should
1196:             *	    not be exposed outside this class.</p>
1197:             *
1198:             *	@param	key	The logger to use as specified by the String.
1199:             */
1200:            private static Logger getLogger(String key) {
1201:                if (key.trim().length() == 0) {
1202:                    return DEFAULT_LOGGER;
1203:                }
1204:                return Logger.getLogger(key);
1205:            }
1206:
1207:            /**
1208:             *	<p> This method provides direct access to the Logger.  It is private
1209:             *	    because the internals of what type of logger is being used should
1210:             *	    not be exposed outside this class.</p>
1211:             *
1212:             *	@param	key	The logger to use as specified by the Class.
1213:             */
1214:            private static Logger getLogger(Class key) {
1215:                if (key == null) {
1216:                    return DEFAULT_LOGGER;
1217:                }
1218:                return Logger.getLogger(key.getName());
1219:            }
1220:
1221:            /**
1222:             *	<p> This method gets the appropriate message to display.  It will
1223:             *	    attempt to resolve it from the <code>ResourceBundle</code>.
1224:             *	    If not found and it will either use the message id as the key,
1225:             *	    or it will return an error message depending on whether
1226:             *	    <code>strict</code> is true or false.</p>
1227:             *
1228:             *	@param	msgId	The message key
1229:             *	@param	strict	True if key not found should be an error
1230:             *
1231:             *	@return	The message to write to the log file.
1232:             */
1233:            private static String getMessage(String msgId, boolean strict) {
1234:                return getMessage(msgId, new Object[0], strict);
1235:            }
1236:
1237:            /**
1238:             *	<p> This method gets the appropriate message to display.  It will
1239:             *	    attempt to resolve it from the <code>ResourceBundle</code>.
1240:             *	    If not found and it will either use the message id as the key,
1241:             *	    or it will return an error message depending on whether
1242:             *	    <code>strict</code> is true or false.</p>
1243:             *
1244:             *	@param	msgId	The message key
1245:             *	@param	params	The parameters
1246:             *	@param	strict	True if key not found should be an error
1247:             *
1248:             *	@return	The message to write to the log file.
1249:             */
1250:            private static String getMessage(String msgId, Object params[],
1251:                    boolean strict) {
1252:                String result = MessageUtil.getMessage(BUNDLE_NAME, msgId,
1253:                        params);
1254:                if (result.equals(msgId)) {
1255:                    // We didn't find the key...
1256:                    if (strict) {
1257:                        // A key is required, return an error message
1258:                        if (msgId.equals(KEY_NOT_FOUND_KEY)) {
1259:                            // This is here to prevent and infinite loop
1260:                            result = KEY_NOT_FOUND_KEY
1261:                                    + LOG_KEY_MESSAGE_SEPARATOR + "'"
1262:                                    + params[0]
1263:                                    + "' not found in ResourceBundle: '"
1264:                                    + BUNDLE_NAME + "'";
1265:                        } else {
1266:                            result = getMessage(KEY_NOT_FOUND_KEY,
1267:                                    new Object[] { msgId }, strict);
1268:                        }
1269:                    } else {
1270:                        // Use the msgId as the message, use the default key
1271:                        result = DEFAULT_LOG_KEY + LOG_KEY_MESSAGE_SEPARATOR
1272:                                + msgId;
1273:                    }
1274:                } else {
1275:                    // We found the key, construct the log format...
1276:                    result = msgId + LOG_KEY_MESSAGE_SEPARATOR + result;
1277:                }
1278:
1279:                // Return the formatted result
1280:                return result;
1281:            }
1282:
1283:            /**
1284:             *	<p> This is the bundle name for the <code>ResourceBundle</code> that
1285:             *	    contains all the message strings.</p>
1286:             */
1287:            public static final String BUNDLE_NAME = "com.sun.rave.web.ui.resources.LogMessages";
1288:
1289:            /**
1290:             *	<p> This is the default log key.</p>
1291:             */
1292:            public static final String DEFAULT_LOG_KEY = "WEBUI0001";
1293:
1294:            /**
1295:             *	<p> This is the default logger name.</p>
1296:             */
1297:            public static final String DEFAULT_LOGGER_NAME = "com.sun.rave.web.ui";
1298:
1299:            /**
1300:             *	<p> This key is used when the requested key is not found to inform the
1301:             *	    developer they forgot to add a key.</p>
1302:             */
1303:            public static final String KEY_NOT_FOUND_KEY = "WEBUI0002";
1304:
1305:            /**
1306:             *	<p> The default Logger.</p>
1307:             */
1308:            private static final Logger DEFAULT_LOGGER = getLogger(DEFAULT_LOGGER_NAME);
1309:
1310:            /**
1311:             *	<p> This is the separator between the the log key and log message.</p>
1312:             */
1313:            private static final String LOG_KEY_MESSAGE_SEPARATOR = ": ";
1314:
1315:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.