Source Code Cross Referenced for Log4JLogger.java in  » Inversion-of-Control » DNA » org » codehaus » dna » impl » 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 » Inversion of Control » DNA » org.codehaus.dna.impl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) The DNA Group. All rights reserved.
003:         *
004:         * This software is published under the terms of the DNA
005:         * Software License version 1.1, a copy of which has been included
006:         * with this distribution in the LICENSE.txt file.
007:         */
008:        package org.codehaus.dna.impl;
009:
010:        import org.apache.log4j.Level;
011:        import org.apache.log4j.Priority;
012:        import org.codehaus.dna.Logger;
013:
014:        /**
015:         * Logging facade implmentation for Apache Log4J project.
016:         * The following lists the mapping between DNA log levels
017:         * and Log4J log levels.
018:         *
019:         * <ul>
020:         *   <li>trace ==&gt; debug</li>
021:         *   <li>debug ==&gt; debug</li>
022:         *   <li>info ==&gt; info</li>
023:         *   <li>warn ==&gt; warn</li>
024:         *   <li>error ==&gt; error</li>
025:         * </ul>
026:         *
027:         * @version $Revision: 1.2 $ $Date: 2004/05/01 09:51:48 $
028:         */
029:        public class Log4JLogger implements  Logger {
030:            /**
031:             * The fully qualified name of the current class so
032:             * Log4J will not include it in traces.
033:             */
034:            private static final String FQCN = Log4JLogger.class.getName();
035:
036:            /**
037:             * The log4j logger instance.
038:             */
039:            private final org.apache.log4j.Logger m_logger;
040:
041:            /**
042:             * Create an instance of Log4J facade.
043:             *
044:             * @param logger the log4j logger
045:             */
046:            public Log4JLogger(final org.apache.log4j.Logger logger) {
047:                if (null == logger) {
048:                    throw new NullPointerException("logger");
049:                }
050:                m_logger = logger;
051:            }
052:
053:            /**
054:             * Log a trace message.
055:             *
056:             * @param message the message
057:             */
058:            public void trace(final String message) {
059:                m_logger.log(FQCN, Level.DEBUG, message, null);
060:            }
061:
062:            /**
063:             * Log a trace message with an associated throwable.
064:             *
065:             * @param message the message
066:             * @param throwable the throwable
067:             */
068:            public void trace(final String message, final Throwable throwable) {
069:                m_logger.log(FQCN, Level.DEBUG, message, throwable);
070:            }
071:
072:            /**
073:             * Return true if a trace message will be logged.
074:             *
075:             * @return true if message will be logged
076:             */
077:            public boolean isTraceEnabled() {
078:                return m_logger.isDebugEnabled();
079:            }
080:
081:            /**
082:             * Log a debug message.
083:             *
084:             * @param message the message
085:             */
086:            public void debug(final String message) {
087:                m_logger.log(FQCN, Level.DEBUG, message, null);
088:            }
089:
090:            /**
091:             * Log a debug message with an associated throwable.
092:             *
093:             * @param message the message
094:             * @param throwable the throwable
095:             */
096:            public void debug(final String message, final Throwable throwable) {
097:                m_logger.log(FQCN, Level.DEBUG, message, throwable);
098:            }
099:
100:            /**
101:             * Return true if a debug message will be logged.
102:             *
103:             * @return true if message will be logged
104:             */
105:            public boolean isDebugEnabled() {
106:                return m_logger.isDebugEnabled();
107:            }
108:
109:            /**
110:             * Log a info message.
111:             *
112:             * @param message the message
113:             */
114:            public void info(final String message) {
115:                m_logger.log(FQCN, Level.INFO, message, null);
116:            }
117:
118:            /**
119:             * Log a info message with an associated throwable.
120:             *
121:             * @param message the message
122:             * @param throwable the throwable
123:             */
124:            public void info(final String message, final Throwable throwable) {
125:                m_logger.log(FQCN, Level.INFO, message, throwable);
126:            }
127:
128:            /**
129:             * Return true if an info message will be logged.
130:             *
131:             * @return true if message will be logged
132:             */
133:            public boolean isInfoEnabled() {
134:                return m_logger.isInfoEnabled();
135:            }
136:
137:            /**
138:             * Log a warn message.
139:             *
140:             * @param message the message
141:             */
142:            public void warn(final String message) {
143:                m_logger.log(FQCN, Level.WARN, message, null);
144:            }
145:
146:            /**
147:             * Log a warn message with an associated throwable.
148:             *
149:             * @param message the message
150:             * @param throwable the throwable
151:             */
152:            public void warn(final String message, final Throwable throwable) {
153:                m_logger.log(FQCN, Level.WARN, message, throwable);
154:            }
155:
156:            /**
157:             * Return true if a warn message will be logged.
158:             *
159:             * @return true if message will be logged
160:             */
161:            public boolean isWarnEnabled() {
162:                return m_logger.isEnabledFor(Priority.WARN);
163:            }
164:
165:            /**
166:             * Log a error message.
167:             *
168:             * @param message the message
169:             */
170:            public void error(final String message) {
171:                m_logger.log(FQCN, Level.ERROR, message, null);
172:            }
173:
174:            /**
175:             * Log a error message with an associated throwable.
176:             *
177:             * @param message the message
178:             * @param throwable the throwable
179:             */
180:            public void error(final String message, final Throwable throwable) {
181:                m_logger.log(FQCN, Level.ERROR, message, throwable);
182:            }
183:
184:            /**
185:             * Return true if a error message will be logged.
186:             *
187:             * @return true if message will be logged
188:             */
189:            public boolean isErrorEnabled() {
190:                return m_logger.isEnabledFor(Priority.ERROR);
191:            }
192:
193:            /**
194:             * Get the child logger with specified name.
195:             *
196:             * @param name the name of child logger
197:             * @return the child logger
198:             */
199:            public Logger getChildLogger(final String name) {
200:
201:                return new Log4JLogger(org.apache.log4j.Logger
202:                        .getLogger(m_logger.getName() + "." + name));
203:            }
204:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.