ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/client/alerters/Logging__Alerter.java
Revision: 1.6
Committed: Sun Aug 1 10:40:43 2004 UTC (19 years, 9 months ago) by tdb
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +3 -3 lines
Error occurred while calculating annotation data.
Log Message:
Catch a lot of old URL's and update them. Also remove a couple of old files
that aren't used.

File Contents

# Content
1 /*
2 * i-scream central monitoring system
3 * http://www.i-scream.org
4 * Copyright (C) 2000-2002 i-scream
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21 //---PACKAGE DECLARATION---
22 package uk.org.iscream.cms.server.client.alerters;
23
24 //---IMPORTS---
25 import uk.org.iscream.cms.server.client.*;
26 import uk.org.iscream.cms.server.core.*;
27 import uk.org.iscream.cms.util.*;
28 import uk.org.iscream.cms.server.componentmanager.*;
29 import java.io.*;
30 import java.util.StringTokenizer;
31
32
33 /**
34 * This alerter writes alerts to the system logfile.
35 *
36 * @author $Author: tdb $
37 * @version $Id: Logging__Alerter.java,v 1.5 2003/02/05 16:43:45 tdb Exp $
38 */
39 public class Logging__Alerter extends AlerterSkeleton {
40
41 //---FINAL ATTRIBUTES---
42
43 /**
44 * The current CVS revision of this class
45 */
46 public final String REVISION = "$Revision: 1.5 $";
47
48 /**
49 * A description of this alerter
50 */
51 public final String DESC = "Writes alerts to the system logfile.";
52
53 //---STATIC METHODS---
54
55 //---CONSTRUCTORS---
56
57 //---PUBLIC METHODS---
58
59 /**
60 * Implements the abstract method from the skeleton class.
61 * This method will attempt to send an alert
62 * message using the configuration.
63 *
64 * @param alert the alert to send
65 */
66 public void sendAlert(Alert alert) {
67 // get the line and replace accordingly
68 String message;
69 try {
70 message = _cp.getProperty(_name, "Alerter.Logging.message");
71 } catch (PropertyNotFoundException e) {
72 message = NOT_CONFIGURED;
73 _logger.write(toString(), Logger.WARNING, "Alerter.Logging.message value unavailable using default of " + message);
74 }
75 message = processAlertMessage(message, alert);
76
77 // write the message at DEBUG level to the system log
78 // -- this could be changed to have an ALERT level, maybe?
79 _logger.write(toString(), Logger.DEBUG, message);
80
81 }
82
83 /**
84 * Overrides the {@link java.lang.Object#toString() Object.toString()}
85 * method to provide clean logging (every class should have this).
86 *
87 * This uses the uk.org.iscream.cms.util.NameFormat class
88 * to format the toString()
89 *
90 * @return the name of this class and its CVS revision
91 */
92 public String toString() {
93 return FormatName.getName(
94 _name,
95 getClass().getName(),
96 REVISION);
97 }
98
99 /**
100 * Return the String representation of what the alerter does
101 *
102 * @return the description
103 */
104 public String getDescription(){
105 return DESC;
106 }
107
108 //---PRIVATE METHODS---
109
110 //---ACCESSOR/MUTATOR METHODS---
111
112 /**
113 * Returns the "friendly" name of this class. This
114 * is simply an accessor for _name, required due to
115 * inheritance issues with extending AlerterSkeleton.
116 *
117 * @return the friendly name
118 */
119 protected String getFName() {
120 return _name;
121 }
122
123 //---ATTRIBUTES---
124
125 /**
126 * This is the friendly identifier of the
127 * component this class is running in.
128 * eg, a Filter may be called "filter1",
129 * If this class does not have an owning
130 * component, a name from the configuration
131 * can be placed here. This name could also
132 * be changed to null for utility classes.
133 */
134 protected String _name = "Logging";
135
136 //---STATIC ATTRIBUTES---
137
138 }