|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
Jdk14LoggerStore.java | - | 100% | 100% | 100% |
|
1 |
/*
|
|
2 |
* Copyright (C) The Spice Group. All rights reserved.
|
|
3 |
*
|
|
4 |
* This software is published under the terms of the Spice
|
|
5 |
* Software License version 1.1, a copy of which has been included
|
|
6 |
* with this distribution in the LICENSE.txt file.
|
|
7 |
*/
|
|
8 |
package org.codehaus.spice.loggerstore.stores;
|
|
9 |
|
|
10 |
import java.io.InputStream;
|
|
11 |
import java.util.logging.LogManager;
|
|
12 |
import org.jcontainer.dna.Logger;
|
|
13 |
import org.jcontainer.dna.impl.Jdk14Logger;
|
|
14 |
|
|
15 |
/**
|
|
16 |
* Jdk14LoggerStore extends AbstractLoggerStore to provide the implementation
|
|
17 |
* specific to the JDK14 logger.
|
|
18 |
*
|
|
19 |
* @author <a href="mailto:mauro.talevi at aquilonia.org">Mauro Talevi</a>
|
|
20 |
*/
|
|
21 |
public class Jdk14LoggerStore |
|
22 |
extends AbstractLoggerStore
|
|
23 |
{ |
|
24 |
/** The LogManager repository */
|
|
25 |
private final LogManager m_manager;
|
|
26 |
|
|
27 |
/**
|
|
28 |
* Creates a <code>Log4JLoggerStore</code> using the configuration
|
|
29 |
* resource.
|
|
30 |
*
|
|
31 |
* @param resource the InputStream encoding the configuration resource
|
|
32 |
* @throws Exception if fails to create or configure Logger
|
|
33 |
*/
|
|
34 | 15 |
public Jdk14LoggerStore( final InputStream resource )
|
35 |
throws Exception
|
|
36 |
{ |
|
37 | 15 |
m_manager = LogManager.getLogManager(); |
38 | 15 |
m_manager.readConfiguration( resource ); |
39 | 15 |
setRootLogger( new Jdk14Logger( m_manager.getLogger( "global" ) ) ); |
40 |
} |
|
41 |
|
|
42 |
/**
|
|
43 |
* Creates new Jdk14Logger for the given category.
|
|
44 |
*/
|
|
45 | 15 |
protected Logger createLogger( final String name )
|
46 |
{ |
|
47 | 15 |
return new Jdk14Logger( java.util.logging.Logger.getLogger( name ) ); |
48 |
} |
|
49 |
|
|
50 |
/**
|
|
51 |
* Closes the LoggerStore and shuts down the logger hierarchy.
|
|
52 |
*/
|
|
53 | 15 |
public void close() |
54 |
{ |
|
55 | 15 |
m_manager.reset(); |
56 |
} |
|
57 |
} |
|
58 |
|
|