Source Code Cross Referenced for WSRPLogger.java in  » Web-Framework » cocoon » org » apache » cocoon » portal » wsrp » logging » 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 » Web Framework » cocoon » org.apache.cocoon.portal.wsrp.logging 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.cocoon.portal.wsrp.logging;
018:
019:        import org.apache.wsrp4j.log.Logger;
020:
021:        /**
022:         * A wrapper for the cocoon logger<br/>
023:         *
024:         * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
025:         * @author <a href="mailto:malessandrini@s-und-n.de">Michel Alessandrini</a>
026:         *
027:         * @version $Id: WSRPLogger.java 433543 2006-08-22 06:22:54Z crossley $
028:         */
029:        public class WSRPLogger implements  Logger {
030:
031:            /** The avalon logger */
032:            protected final org.apache.avalon.framework.logger.Logger logger;
033:
034:            /**
035:             * constructor<br/>
036:             * 
037:             * @param logger
038:             */
039:            public WSRPLogger(org.apache.avalon.framework.logger.Logger logger) {
040:                this .logger = logger;
041:            }
042:
043:            /**
044:             * @see org.apache.wsrp4j.log.Logger#entry(int, java.lang.String)
045:             */
046:            public void entry(int logLevel, String loggingMethod) {
047:                this .entry(logLevel, loggingMethod, null);
048:            }
049:
050:            /**
051:             * @see org.apache.wsrp4j.log.Logger#entry(int, java.lang.String, java.lang.Object)
052:             */
053:            public void entry(int logLevel, String loggingMethod, Object parm1) {
054:                this .entry(logLevel, loggingMethod, new Object[] { parm1 });
055:            }
056:
057:            /**
058:             * @see org.apache.wsrp4j.log.Logger#entry(int, java.lang.String, java.lang.Object[])
059:             */
060:            public void entry(int logLevel, String loggingMethod, Object[] parms) {
061:                this .text(logLevel, loggingMethod, "Entering method", parms);
062:            }
063:
064:            /**
065:             * @see org.apache.wsrp4j.log.Logger#exit(int, java.lang.String)
066:             */
067:            public void exit(int logLevel, String loggingMethod) {
068:                this .text(logLevel, loggingMethod, "Exiting method.");
069:            }
070:
071:            /**
072:             * @see org.apache.wsrp4j.log.Logger#exit(int, java.lang.String, byte)
073:             */
074:            public void exit(int logLevel, String loggingMethod, byte retValue) {
075:                this .exit(logLevel, loggingMethod, new Byte(retValue));
076:            }
077:
078:            /**
079:             * @see org.apache.wsrp4j.log.Logger#exit(int, java.lang.String, short)
080:             */
081:            public void exit(int logLevel, String loggingMethod, short retValue) {
082:                this .exit(logLevel, loggingMethod, new Short(retValue));
083:            }
084:
085:            /**
086:             * @see org.apache.wsrp4j.log.Logger#exit(int, java.lang.String, int)
087:             */
088:            public void exit(int logLevel, String loggingMethod, int retValue) {
089:                this .exit(logLevel, loggingMethod, new Integer(retValue));
090:            }
091:
092:            /**
093:             * @see org.apache.wsrp4j.log.Logger#exit(int, java.lang.String, long)
094:             */
095:            public void exit(int logLevel, String loggingMethod, long retValue) {
096:                this .exit(logLevel, loggingMethod, new Long(retValue));
097:            }
098:
099:            /**
100:             * @see org.apache.wsrp4j.log.Logger#exit(int, java.lang.String, float)
101:             */
102:            public void exit(int logLevel, String loggingMethod, float retValue) {
103:                this .exit(logLevel, loggingMethod, new Float(retValue));
104:            }
105:
106:            /**
107:             * @see org.apache.wsrp4j.log.Logger#exit(int, java.lang.String, double)
108:             */
109:            public void exit(int logLevel, String loggingMethod, double retValue) {
110:                this .exit(logLevel, loggingMethod, new Double(retValue));
111:            }
112:
113:            /**
114:             * @see org.apache.wsrp4j.log.Logger#exit(int, java.lang.String, char)
115:             */
116:            public void exit(int logLevel, String loggingMethod, char retValue) {
117:                this .exit(logLevel, loggingMethod, new Character(retValue));
118:            }
119:
120:            /**
121:             * @see org.apache.wsrp4j.log.Logger#exit(int, java.lang.String, boolean)
122:             */
123:            public void exit(int logLevel, String loggingMethod,
124:                    boolean retValue) {
125:                this .exit(logLevel, loggingMethod, new Boolean(retValue));
126:            }
127:
128:            /**
129:             * @see org.apache.wsrp4j.log.Logger#exit(int, java.lang.String, java.lang.Object)
130:             */
131:            public void exit(int logLevel, String loggingMethod, Object retValue) {
132:                this .text(logLevel, loggingMethod,
133:                        "Exiting method. Returned value: {0}", retValue);
134:            }
135:
136:            /**
137:             * @see org.apache.wsrp4j.log.Logger#isLogging(int)
138:             */
139:            public boolean isLogging(int logLevel) {
140:                if (logLevel == Logger.ERROR) {
141:                    return this .logger.isErrorEnabled();
142:                } else if (logLevel == Logger.INFO) {
143:                    return this .logger.isInfoEnabled();
144:                } else if (logLevel == Logger.WARN) {
145:                    return this .logger.isWarnEnabled();
146:                } else if (logLevel == Logger.TRACE_HIGH) {
147:                    return this .logger.isInfoEnabled();
148:                } else if (logLevel == Logger.TRACE_MEDIUM) {
149:                    return this .logger.isDebugEnabled();
150:                } else if (logLevel == Logger.TRACE_LOW) {
151:                    return this .logger.isDebugEnabled();
152:                }
153:                return false;
154:            }
155:
156:            /**
157:             * @see org.apache.wsrp4j.log.Logger#stackTrace(int, java.lang.String, java.lang.String)
158:             */
159:            public void stackTrace(int logLevel, String loggingMethod,
160:                    String text) {
161:                this .text(logLevel, loggingMethod, new Throwable("Stacktrace"),
162:                        text);
163:            }
164:
165:            /**
166:             * @see org.apache.wsrp4j.log.Logger#text(int, java.lang.String, java.lang.String)
167:             */
168:            public void text(int logLevel, String loggingMethod, String text) {
169:                this .text(logLevel, loggingMethod, text, null);
170:            }
171:
172:            /**
173:             * @see org.apache.wsrp4j.log.Logger#text(int, java.lang.String, java.lang.String, java.lang.Object)
174:             */
175:            public void text(int logLevel, String loggingMethod, String text,
176:                    Object parm1) {
177:                this 
178:                        .text(logLevel, loggingMethod, text,
179:                                new Object[] { parm1 });
180:            }
181:
182:            /**
183:             * @see org.apache.wsrp4j.log.Logger#text(int, java.lang.String, java.lang.String, java.lang.Object[])
184:             */
185:            public void text(int logLevel, String loggingMethod, String text,
186:                    Object[] parms) {
187:                this .text(logLevel, loggingMethod, (Throwable) null, text,
188:                        parms);
189:            }
190:
191:            /**
192:             * @see org.apache.wsrp4j.log.Logger#text(int, java.lang.String, java.lang.Throwable, java.lang.String)
193:             */
194:            public void text(int logLevel, String loggingMethod, Throwable t,
195:                    String text) {
196:                this .text(logLevel, loggingMethod, t, text, null);
197:            }
198:
199:            /**
200:             * @see org.apache.wsrp4j.log.Logger#text(int, java.lang.String, java.lang.Throwable, java.lang.String, java.lang.Object[])
201:             */
202:            public void text(int logLevel, String loggingMethod, Throwable t,
203:                    String text, Object[] parms) {
204:                if (!this .isLogging(logLevel)) {
205:                    return;
206:                }
207:                StringBuffer msgBuffer = new StringBuffer();
208:                if (loggingMethod != null) {
209:                    msgBuffer.append(loggingMethod);
210:                    msgBuffer.append(" - ");
211:                }
212:                if (text != null) {
213:                    msgBuffer.append(text);
214:                }
215:                if (parms != null) {
216:                    msgBuffer.append("\nParameters:\n");
217:                    for (int i = 0; i < parms.length; i++) {
218:                        msgBuffer.append(parms[i]);
219:                    }
220:                }
221:
222:                if (logLevel == Logger.ERROR) {
223:                    this.logger.error(msgBuffer.toString(), t);
224:                } else if (logLevel == Logger.INFO) {
225:                    this.logger.info(msgBuffer.toString(), t);
226:                } else if (logLevel == Logger.WARN) {
227:                    this.logger.warn(msgBuffer.toString(), t);
228:                } else if (logLevel == Logger.TRACE_HIGH) {
229:                    this.logger.info(msgBuffer.toString(), t);
230:                } else if (logLevel == Logger.TRACE_MEDIUM) {
231:                    this.logger.debug(msgBuffer.toString(), t);
232:                } else if (logLevel == Logger.TRACE_LOW) {
233:                    this.logger.debug(msgBuffer.toString(), t);
234:                }
235:            }
236:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.