KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > grlea > log > test > commons > SimpleCommonsLoggingClass


1 package org.grlea.log.test.commons;
2
3 // $Id: SimpleCommonsLoggingClass.java,v 1.3 2006/07/13 12:44:54 grlea Exp $
4
// Copyright (c) 2004-2006 Graham Lea. All rights reserved.
5

6 // Licensed under the Apache License, Version 2.0 (the "License");
7
// you may not use this file except in compliance with the License.
8
// You may obtain a copy of the License at
9
//
10
// http://www.apache.org/licenses/LICENSE-2.0
11
//
12
// Unless required by applicable law or agreed to in writing, software
13
// distributed under the License is distributed on an "AS IS" BASIS,
14
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
// See the License for the specific language governing permissions and
16
// limitations under the License.
17

18 import org.grlea.log.SimpleLog;
19 import org.grlea.log.SimpleLogger;
20
21 import org.apache.commons.logging.LogFactory;
22 import org.apache.commons.logging.Log;
23
24 /**
25  * <p></p>
26  *
27  * @author Graham Lea
28  * @version $Revision: 1.3 $
29  */

30 public class
31 SimpleCommonsLoggingClass
32 {
33    private final Log log;
34
35    public
36    SimpleCommonsLoggingClass()
37    {
38       log = LogFactory.getLog(getClass());
39    }
40
41    public
42    SimpleCommonsLoggingClass(String JavaDoc loggerName)
43    {
44       log = LogFactory.getLog(loggerName);
45    }
46
47    public Log
48    getLog()
49    {
50       return log;
51    }
52
53    public void
54    doSomeLogging()
55    {
56       log.fatal("Test of Fatal");
57       log.error("Test of Error");
58       log.warn("Test of Warn");
59       log.info("Test of Info");
60       log.debug("Test of Debug");
61       log.trace("Test of Trace");
62    }
63
64    public void
65    doSomeTracing()
66    {
67       log.trace("IN: doSomeTracing()");
68       log.trace("OUT: doSomeTracing()");
69    }
70
71    public void
72    logAnError()
73    {
74       log.info("Test of Exception", new Throwable JavaDoc("Test Message"));
75    }
76 }
Popular Tags