1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.velocity.internal.log

File SLF4JLogChute.java

 

Coverage histogram

../../../../../img/srcFileCovDistChart9.png
38% of files have more coverage

Code metrics

2
5
2
1
66
24
3
0.6
2.5
2
1.5

Classes

Class Line # Actions
SLF4JLogChute 32 5 0% 3 1
0.888888988.9%
 

Contributing tests

This file is covered by 17 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.velocity.internal.log;
21   
22    import org.apache.velocity.runtime.RuntimeServices;
23    import org.slf4j.Logger;
24    import org.slf4j.LoggerFactory;
25   
26    /**
27    * Redirects Velocity's LogChute messages to slf4j.
28    *
29    * @version $Id: 312c513febe402fe041ebfcce136750aed60839b $
30    * @since 4.3M2
31    */
 
32    public class SLF4JLogChute extends AbstractSLF4JLogChute
33    {
34    /**
35    * The name of the property containing custom logger name.
36    */
37    public static final String RUNTIME_LOG_SLF4J_LOGGER = "runtime.log.logsystem.slf4j.logger";
38   
39    /**
40    * Default name for the logger instance.
41    */
42    public static final String DEFAULT_LOG_NAME = "org.apache.velocity";
43   
44    /**
45    * The SLF4J Logger instance.
46    */
47    protected Logger logger;
48   
 
49  17 toggle @Override
50    public void init(RuntimeServices rs)
51    {
52  17 String name = (String) rs.getProperty(RUNTIME_LOG_SLF4J_LOGGER);
53   
54  17 if (name == null) {
55  17 name = DEFAULT_LOG_NAME;
56    }
57   
58  17 this.logger = LoggerFactory.getLogger(name);
59    }
60   
 
61  527 toggle @Override
62    protected Logger getLogger()
63    {
64  527 return this.logger;
65    }
66    }