Source Code Cross Referenced for Log.java in  » Template-Engine » Velocity » org » apache » velocity » runtime » log » 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 » Template Engine » Velocity » org.apache.velocity.runtime.log 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.velocity.runtime.log;
002:
003:        /*
004:         * Licensed to the Apache Software Foundation (ASF) under one
005:         * or more contributor license agreements.  See the NOTICE file
006:         * distributed with this work for additional information
007:         * regarding copyright ownership.  The ASF licenses this file
008:         * to you under the Apache License, Version 2.0 (the
009:         * "License"); you may not use this file except in compliance
010:         * with the License.  You may obtain a copy of the License at
011:         *
012:         *   http://www.apache.org/licenses/LICENSE-2.0
013:         *
014:         * Unless required by applicable law or agreed to in writing,
015:         * software distributed under the License is distributed on an
016:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017:         * KIND, either express or implied.  See the License for the
018:         * specific language governing permissions and limitations
019:         * under the License.    
020:         */
021:
022:        /**
023:         * Convenient wrapper for LogChute functions. This implements
024:         * the RuntimeLogger methods (and then some).  It is hoped that
025:         * use of this will fully replace use of the RuntimeLogger.
026:         *
027:         * @author <a href="mailto:nbubna@apache.org">Nathan Bubna</a>
028:         * @version $Id: Log.java 469919 2006-11-01 14:35:46Z henning $
029:         */
030:        public class Log {
031:
032:            private LogChute chute;
033:
034:            /**
035:             * Creates a new Log that wraps a HoldingLogChute.
036:             */
037:            public Log() {
038:                setLogChute(new HoldingLogChute());
039:            }
040:
041:            /**
042:             * Creates a new Log that wraps the specified LogChute.
043:             * @param chute
044:             */
045:            public Log(final LogChute chute) {
046:                setLogChute(chute);
047:            }
048:
049:            /**
050:             * Updates the LogChute wrapped by this Log instance.
051:             * @param chute The new value for the log chute.
052:             */
053:            protected void setLogChute(final LogChute chute) {
054:                if (chute == null) {
055:                    throw new NullPointerException(
056:                            "The LogChute cannot be set to null!");
057:                }
058:                this .chute = chute;
059:            }
060:
061:            /**
062:             * Returns the LogChute wrapped by this Log instance.
063:             * @return The LogChute wrapped by this Log instance.
064:             */
065:            protected LogChute getLogChute() {
066:                return this .chute;
067:            }
068:
069:            protected void log(int level, Object message) {
070:                getLogChute().log(level, String.valueOf(message));
071:            }
072:
073:            protected void log(int level, Object message, Throwable t) {
074:                getLogChute().log(level, String.valueOf(message), t);
075:            }
076:
077:            /**
078:             * Returns true if trace level messages will be printed by the LogChute.
079:             * @return If trace level messages will be printed by the LogChute.
080:             */
081:            public boolean isTraceEnabled() {
082:                return getLogChute().isLevelEnabled(LogChute.TRACE_ID);
083:            }
084:
085:            /**
086:             * Log a trace message.
087:             * @param message
088:             */
089:            public void trace(Object message) {
090:                log(LogChute.TRACE_ID, message);
091:            }
092:
093:            /**
094:             * Log a trace message and accompanying Throwable.
095:             * @param message
096:             * @param t
097:             */
098:            public void trace(Object message, Throwable t) {
099:                log(LogChute.TRACE_ID, message, t);
100:            }
101:
102:            /**
103:             * Returns true if debug level messages will be printed by the LogChute.
104:             * @return True if debug level messages will be printed by the LogChute.
105:             */
106:            public boolean isDebugEnabled() {
107:                return getLogChute().isLevelEnabled(LogChute.DEBUG_ID);
108:            }
109:
110:            /**
111:             * Log a debug message.
112:             * @param message
113:             */
114:            public void debug(Object message) {
115:                log(LogChute.DEBUG_ID, message);
116:            }
117:
118:            /**
119:             * Log a debug message and accompanying Throwable.
120:             * @param message
121:             * @param t
122:             */
123:            public void debug(Object message, Throwable t) {
124:                log(LogChute.DEBUG_ID, message, t);
125:            }
126:
127:            /**
128:             * Returns true if info level messages will be printed by the LogChute.
129:             * @return True if info level messages will be printed by the LogChute.
130:             */
131:            public boolean isInfoEnabled() {
132:                return getLogChute().isLevelEnabled(LogChute.INFO_ID);
133:            }
134:
135:            /**
136:             * Log an info message.
137:             * @param message
138:             */
139:            public void info(Object message) {
140:                log(LogChute.INFO_ID, message);
141:            }
142:
143:            /**
144:             * Log an info message and accompanying Throwable.
145:             * @param message
146:             * @param t
147:             */
148:            public void info(Object message, Throwable t) {
149:                log(LogChute.INFO_ID, message, t);
150:            }
151:
152:            /**
153:             * Returns true if warn level messages will be printed by the LogChute.
154:             * @return True if warn level messages will be printed by the LogChute.
155:             */
156:            public boolean isWarnEnabled() {
157:                return getLogChute().isLevelEnabled(LogChute.WARN_ID);
158:            }
159:
160:            /**
161:             * Log a warning message.
162:             * @param message
163:             */
164:            public void warn(Object message) {
165:                log(LogChute.WARN_ID, message);
166:            }
167:
168:            /**
169:             * Log a warning message and accompanying Throwable.
170:             * @param message
171:             * @param t
172:             */
173:            public void warn(Object message, Throwable t) {
174:                log(LogChute.WARN_ID, message, t);
175:            }
176:
177:            /**
178:             * Returns true if error level messages will be printed by the LogChute.
179:             * @return True if error level messages will be printed by the LogChute.
180:             */
181:            public boolean isErrorEnabled() {
182:                return getLogChute().isLevelEnabled(LogChute.ERROR_ID);
183:            }
184:
185:            /**
186:             * Log an error message.
187:             * @param message
188:             */
189:            public void error(Object message) {
190:                log(LogChute.ERROR_ID, message);
191:            }
192:
193:            /**
194:             * Log an error message and accompanying Throwable.
195:             * @param message
196:             * @param t
197:             */
198:            public void error(Object message, Throwable t) {
199:                log(LogChute.ERROR_ID, message, t);
200:            }
201:
202:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.