KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > pluto > portalImpl > services > log > StandardOutLogService


1 /*
2  * Copyright 2003,2004 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
18  */

19
20 package org.apache.pluto.portalImpl.services.log;
21
22 import org.apache.pluto.services.log.Logger;
23
24 /** Defines a LogService that may be used when
25  * one has not been registered with the ServiceManager.
26  * This is specifically usefull in cases, such as
27  * when the Deployer is run, in which no Service are
28  * registered.
29  *
30  * The StandardOutLogService is implemented as a
31  * Singleton since all log messages will be going
32  * to StandardOut no matter what! Since all behaivior
33  * will be identical, there's no reason to create
34  * multiple instances.
35  */

36 public class StandardOutLogService extends LogService {
37
38     private static Logger logger = null;
39
40     private static LogService service;
41
42     public static LogService getInstance() {
43         if(service==null)
44             service = new StandardOutLogService();
45         return service;
46     }
47
48     private StandardOutLogService() {
49         logger = new StandardOutLogger();
50     }
51
52     public Logger getLogger(String JavaDoc aComponent) {
53         return logger;
54     }
55     
56     public Logger getLogger(Class JavaDoc klass) {
57         return logger;
58     }
59
60 }
61
Popular Tags