001/* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 018package org.apache.log4j.spi; 019 020import org.apache.log4j.Level; 021import org.apache.log4j.Logger; 022import org.apache.log4j.helpers.LogLog; 023 024// Contibutors: Mathias Bogaert 025 026/** 027 * @deprecated Replaced by {@link RootLogger}. 028 */ 029final public class RootCategory extends Logger { 030 031 /** 032 The root category names itself as "root". However, the root 033 category cannot be retrieved by name. 034 */ 035 public 036 RootCategory(Level level) { 037 super("root"); 038 setLevel(level); 039 } 040 041 042 /** 043 Return the assigned level value without walking the category 044 hierarchy. 045 */ 046 final 047 public 048 Level getChainedLevel() { 049 return level; 050 } 051 052 /** 053 Setting a null value to the level of the root category may have catastrophic 054 results. We prevent this here. 055 056 @since 0.8.3 */ 057 final 058 public 059 void setLevel(Level level) { 060 if(level == null) { 061 LogLog.error("You have tried to set a null level to root.", 062 new Throwable()); 063 } 064 else { 065 this.level = level; 066 } 067 } 068 069 final 070 public 071 void setPriority(Level level) { 072 setLevel(level); 073 } 074 075 076}