KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > log4j > spi > RootCategory


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

16
17 package org.apache.log4j.spi;
18
19 import org.apache.log4j.*;
20 import org.apache.log4j.helpers.LogLog;
21
22 // Contibutors: Mathias Bogaert
23

24 /**
25  * @deprecated Replaced by {@link RootLogger}.
26  */

27 final public class RootCategory extends Logger {
28
29   /**
30      The root category names itself as "root". However, the root
31      category cannot be retrieved by name.
32   */

33   public
34   RootCategory(Level level) {
35     super("root");
36     setLevel(level);
37   }
38
39   
40   /**
41      Return the assigned level value without walking the category
42      hierarchy.
43   */

44   final
45   public
46   Level getChainedLevel() {
47     return level;
48   }
49
50   /**
51      Setting a null value to the level of the root category may have catastrophic
52      results. We prevent this here.
53
54      @since 0.8.3 */

55   final
56   public
57   void setLevel(Level level) {
58     if(level == null) {
59       LogLog.error("You have tried to set a null level to root.",
60            new Throwable JavaDoc());
61     }
62     else {
63       this.level = level;
64     }
65   }
66
67   final
68   public
69   void setPriority(Level level) {
70     setLevel(level);
71   }
72
73   
74 }
75
Popular Tags