001 /* 002 * Copyright 2005 Stephen J. McConnell. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 013 * implied. 014 * 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018 019 package net.dpml.test.categories; 020 021 import net.dpml.logging.Logger; 022 023 /** 024 * Test component used to validate logging category declarations. 025 * 026 * @author <a href="http://www.dpml.net">Digital Product Meta Library</a> 027 * @version 1.2.0 028 */ 029 public class CategoriesComponent 030 { 031 //------------------------------------------------------------------ 032 // state 033 //------------------------------------------------------------------ 034 035 /** 036 * The supplied logging channel. 037 */ 038 private final Logger m_logger; 039 040 /** 041 * The the alpha child logging channel. 042 */ 043 private final Logger m_alpha; 044 045 /** 046 * The the beta child logging channel. 047 */ 048 private final Logger m_beta; 049 050 051 //------------------------------------------------------------------ 052 // constructor 053 //------------------------------------------------------------------ 054 055 /** 056 * Creation of a new startable component instance. 057 * @param logger the assingned logging channel 058 */ 059 public CategoriesComponent( final Logger logger ) 060 { 061 m_logger = logger; 062 m_alpha = logger.getChildLogger( "alpha" ); 063 m_beta = logger.getChildLogger( "beta" ); 064 065 // under the default configuration only info level messages 066 // are listed to console however the component configuratuion 067 // is overriding this to restrict the alpha and betwa channels 068 // to warn and error priority respectively - as such no log 069 // messages appear during a normal test 070 071 m_logger.debug( "instantiation complete" ); 072 m_alpha.info( "an alpha channel message" ); 073 m_beta.info( "an beta channel message" ); 074 } 075 }