EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.logging.log4j]

COVERAGE SUMMARY FOR SOURCE FILE [Log4JLogger.java]

nameclass, %method, %block, %line, %
Log4JLogger.java100% (2/2)25%  (4/16)27%  (22/81)27%  (7/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Log4JLogger100% (1/1)14%  (2/14)17%  (12/71)21%  (5/24)
isDebugEnabled (): boolean 0%   (0/1)0%   (0/4)0%   (0/1)
isErrorEnabled (): boolean 0%   (0/1)0%   (0/5)0%   (0/1)
isInfoEnabled (): boolean 0%   (0/1)0%   (0/4)0%   (0/1)
isTraceEnabled (): boolean 0%   (0/1)0%   (0/4)0%   (0/1)
isWarnEnabled (): boolean 0%   (0/1)0%   (0/5)0%   (0/1)
logDebug (String): void 0%   (0/1)0%   (0/5)0%   (0/2)
logError (String): void 0%   (0/1)0%   (0/5)0%   (0/2)
logError (String, Throwable): void 0%   (0/1)0%   (0/6)0%   (0/2)
logInfo (String): void 0%   (0/1)0%   (0/5)0%   (0/2)
logTrace (String): void 0%   (0/1)0%   (0/5)0%   (0/2)
logWarn (String): void 0%   (0/1)0%   (0/5)0%   (0/2)
logWarn (String, Throwable): void 0%   (0/1)0%   (0/6)0%   (0/2)
Log4JLogger (String, Logger): void 100% (1/1)100% (9/9)100% (4/4)
getCategory (): String 100% (1/1)100% (3/3)100% (1/1)
     
class Log4JLogger$Log4JLoggerFactory100% (1/1)100% (2/2)100% (10/10)100% (2/2)
Log4JLogger$Log4JLoggerFactory (): void 100% (1/1)100% (3/3)100% (1/1)
getLogger (String): Logger 100% (1/1)100% (7/7)100% (1/1)

1/**
2 * Licensed to jclouds, Inc. (jclouds) under one or more
3 * contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  jclouds licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  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,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.jclouds.logging.log4j;
20 
21import static org.apache.log4j.Level.ERROR;
22import static org.apache.log4j.Level.WARN;
23 
24import org.jclouds.logging.BaseLogger;
25import org.jclouds.logging.Logger;
26 
27/**
28 * {@link org.apache.log4j.Logger} implementation of {@link Logger}.
29 * 
30 * @author Adrian Cole
31 * 
32 */
33public class Log4JLogger extends BaseLogger {
34    private final org.apache.log4j.Logger logger;
35    private final String category;
36 
37    public static class Log4JLoggerFactory implements LoggerFactory {
38        public Logger getLogger(String category) {
39            return new Log4JLogger(category, org.apache.log4j.Logger
40                    .getLogger(category));
41        }
42    }
43 
44    public Log4JLogger(String category, org.apache.log4j.Logger logger) {
45        this.category = category;
46        this.logger = logger;
47    }
48 
49    @Override
50    protected void logTrace(String message) {
51        logger.trace(message);
52    }
53 
54    public boolean isTraceEnabled() {
55        return logger.isTraceEnabled();
56    }
57 
58    @Override
59    protected void logDebug(String message) {
60        logger.debug(message);
61    }
62 
63    public boolean isDebugEnabled() {
64        return logger.isDebugEnabled();
65    }
66 
67    @Override
68    protected void logInfo(String message) {
69        logger.info(message);
70    }
71 
72    public boolean isInfoEnabled() {
73        return logger.isInfoEnabled();
74    }
75 
76    @Override
77    protected void logWarn(String message) {
78        logger.warn(message);
79    }
80 
81    @Override
82    protected void logWarn(String message, Throwable e) {
83        logger.warn(message, e);
84    }
85 
86    public boolean isWarnEnabled() {
87        return logger.isEnabledFor(WARN);
88    }
89 
90    @Override
91    protected void logError(String message) {
92        logger.error(message);
93    }
94 
95    @Override
96    protected void logError(String message, Throwable e) {
97        logger.error(message, e);
98    }
99 
100    public boolean isErrorEnabled() {
101        return logger.isEnabledFor(ERROR);
102    }
103 
104    public String getCategory() {
105        return category;
106    }
107}

[all classes][org.jclouds.logging.log4j]
EMMA 2.0.5312 (C) Vladimir Roubtsov