Source Code Cross Referenced for JPOXLogger.java in  » Database-ORM » JPOX » org » jpox » 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 » Database ORM » JPOX » org.jpox.util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************
002:        Copyright (c) 2004 Andy Jefferson and others. All rights reserved. 
003:        Licensed under the Apache License, Version 2.0 (the "License");
004:        you may not use this file except in compliance with the License.
005:        You may obtain a copy of the License at
006:
007:            http://www.apache.org/licenses/LICENSE-2.0
008:
009:        Unless required by applicable law or agreed to in writing, software
010:        distributed under the License is distributed on an "AS IS" BASIS,
011:        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012:        See the License for the specific language governing permissions and
013:        limitations under the License.
014:
015:        Contributors:
016:            ...
017:         **********************************************************************/package org.jpox.util;
018:
019:        /**
020:         * Logging framework for JPOX.
021:         * Allows use of Log4J, JDK1.4, or no logging.
022:         * Performs a similar role to Apache CommonsLogging yet doesnt need
023:         * an extra jar to be present in the CLASSPATH and also allows for no
024:         * available logger.
025:         *
026:         * @version $Revision: 1.24 $   
027:         **/
028:        public abstract class JPOXLogger {
029:            /** Log for JDO issues */
030:            public static final JPOXLogger JDO;
031:
032:            /** Log for JPA issues */
033:            public static final JPOXLogger JPA;
034:
035:            /** Log for Persistence issues */
036:            public static final JPOXLogger PERSISTENCE;
037:
038:            /** Log for Lifecycle issues */
039:            public static final JPOXLogger LIFECYCLE;
040:
041:            /** Log for Query issues */
042:            public static final JPOXLogger QUERY;
043:
044:            /** Log for REACHABILITY issues */
045:            public static final JPOXLogger REACHABILITY;
046:
047:            /** Log for METADATA issues */
048:            public static final JPOXLogger METADATA;
049:
050:            /** Log for MANAGEMENT issues */
051:            public static final JPOXLogger MANAGEMENT;
052:
053:            /** Log for Cache issues */
054:            public static final JPOXLogger CACHE;
055:
056:            /** Log for General issues */
057:            public static final JPOXLogger GENERAL;
058:
059:            /** Log for Transaction issues */
060:            public static final JPOXLogger TRANSACTION;
061:
062:            /** Log for Connection issues */
063:            public static final JPOXLogger CONNECTION;
064:
065:            /** Log for JCA issues */
066:            public static final JPOXLogger JCA;
067:
068:            /** Log for ClassLoading issues */
069:            public static final JPOXLogger CLASSLOADING;
070:
071:            /** Log for PLUGIN issues */
072:            public static final JPOXLogger PLUGIN;
073:
074:            /** Log for POID issues */
075:            public static final JPOXLogger POID;
076:
077:            /** Log for javax.naming issues */
078:            public static final JPOXLogger NAMING;
079:
080:            /** Log for Datastore issues */
081:            public static final JPOXLogger DATASTORE;
082:
083:            /** Log for Datastore persistence issues */
084:            public static final JPOXLogger DATASTORE_PERSIST;
085:
086:            /** Log for Datastore retrieval issues */
087:            public static final JPOXLogger DATASTORE_RETRIEVE;
088:
089:            /** Log for Datastore Schema issues */
090:            public static final JPOXLogger DATASTORE_SCHEMA;
091:
092:            /** Log for IDE */
093:            public static final JPOXLogger IDE;
094:
095:            /** Log for Enhancer */
096:            public static final JPOXLogger ENHANCER;
097:
098:            /** Log for SchemaTool */
099:            public static final JPOXLogger SCHEMATOOL;
100:
101:            static {
102:                // Set the log type to be used based on what is available from this ClassLoader
103:                // Note that we could have registered in the PluginManager but that needs to log too
104:                Class loggerClass = org.jpox.util.NullLogger.class;
105:                try {
106:                    JPOXLogger.class.getClassLoader().loadClass(
107:                            "org.apache.log4j.Logger");
108:                    loggerClass = org.jpox.util.Log4JLogger.class;
109:                } catch (Exception e) {
110:                    if (JavaUtils.isJRE1_4OrAbove()) {
111:                        loggerClass = org.jpox.util.JDK14Logger.class;
112:                    }
113:                }
114:
115:                // Create the Loggers for our predefined categories
116:                // TODO Would be nice to not have to do this, and just allocate them when the first request
117:                // comes in for a particular one, but that would impact on all calling methods
118:                JDO = getLoggerInstance(loggerClass, "JPOX.JDO");
119:                JPA = getLoggerInstance(loggerClass, "JPOX.JPA");
120:
121:                PERSISTENCE = getLoggerInstance(loggerClass, "JPOX.Persistence");
122:                LIFECYCLE = getLoggerInstance(loggerClass, "JPOX.Lifecycle");
123:                QUERY = getLoggerInstance(loggerClass, "JPOX.Query");
124:                REACHABILITY = getLoggerInstance(loggerClass,
125:                        "JPOX.Reachability");
126:                METADATA = getLoggerInstance(loggerClass, "JPOX.MetaData");
127:                CACHE = getLoggerInstance(loggerClass, "JPOX.Cache");
128:                GENERAL = getLoggerInstance(loggerClass, "JPOX.General");
129:                TRANSACTION = getLoggerInstance(loggerClass, "JPOX.Transaction");
130:                PLUGIN = getLoggerInstance(loggerClass, "JPOX.Plugin");
131:                POID = getLoggerInstance(loggerClass, "JPOX.Store.Poid");
132:                CLASSLOADING = getLoggerInstance(loggerClass,
133:                        "JPOX.ClassLoading");
134:                NAMING = getLoggerInstance(loggerClass, "JPOX.Naming");
135:                MANAGEMENT = getLoggerInstance(loggerClass, "JPOX.Management");
136:                CONNECTION = getLoggerInstance(loggerClass, "JPOX.Connection");
137:                JCA = getLoggerInstance(loggerClass, "JPOX.JCA");
138:
139:                DATASTORE = getLoggerInstance(loggerClass, "JPOX.Datastore");
140:                DATASTORE_PERSIST = getLoggerInstance(loggerClass,
141:                        "JPOX.Datastore.Persist");
142:                DATASTORE_RETRIEVE = getLoggerInstance(loggerClass,
143:                        "JPOX.Datastore.Retrieve");
144:                DATASTORE_SCHEMA = getLoggerInstance(loggerClass,
145:                        "JPOX.Datastore.Schema");
146:
147:                IDE = getLoggerInstance(loggerClass, "JPOX.IDE");
148:                ENHANCER = getLoggerInstance(loggerClass, "JPOX.Enhancer");
149:                SCHEMATOOL = getLoggerInstance(loggerClass, "JPOX.SchemaTool");
150:            }
151:
152:            /**
153:             * Method to create a logger instance.
154:             * @param loggerClass The logger class
155:             * @param logCategory The category (or null)
156:             * @return The logger
157:             */
158:            private static JPOXLogger getLoggerInstance(Class loggerClass,
159:                    String logCategory) {
160:                return (JPOXLogger) ClassUtils.newInstance(loggerClass,
161:                        new Class[] { String.class },
162:                        new Object[] { logCategory });
163:            }
164:
165:            /**
166:             * Log a debug message.
167:             * @param msg The message
168:             */
169:            public abstract void debug(Object msg);
170:
171:            /**
172:             * Log a debug message with throwable.
173:             * @param msg The message
174:             * @param thr A throwable
175:             */
176:            public abstract void debug(Object msg, Throwable thr);
177:
178:            /**
179:             * Log an info message.
180:             * @param msg The message
181:             */
182:            public abstract void info(Object msg);
183:
184:            /**
185:             * Log an info message with throwable.
186:             * @param msg The message
187:             * @param thr A throwable
188:             */
189:            public abstract void info(Object msg, Throwable thr);
190:
191:            /**
192:             * Log a warning message.
193:             * @param msg The message
194:             */
195:            public abstract void warn(Object msg);
196:
197:            /**
198:             * Log a warning message with throwable.
199:             * @param msg The message
200:             * @param thr A throwable
201:             */
202:            public abstract void warn(Object msg, Throwable thr);
203:
204:            /**
205:             * Log an error message.
206:             * @param msg The message
207:             */
208:            public abstract void error(Object msg);
209:
210:            /**
211:             * Log an error message with throwable.
212:             * @param msg The message
213:             * @param thr A throwable
214:             */
215:            public abstract void error(Object msg, Throwable thr);
216:
217:            /**
218:             * Log a fatal message.
219:             * @param msg The message
220:             */
221:            public abstract void fatal(Object msg);
222:
223:            /**
224:             * Log a fatal message with throwable.
225:             * @param msg The message
226:             * @param thr A throwable
227:             */
228:            public abstract void fatal(Object msg, Throwable thr);
229:
230:            /**
231:             * Accessor for whether debug logging is enabled
232:             * @return Whether it is enabled
233:             */
234:            public abstract boolean isDebugEnabled();
235:
236:            /**
237:             * Accessor for whether info logging is enabled
238:             * @return Whether it is enabled
239:             */
240:            public abstract boolean isInfoEnabled();
241:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.