Apache log4cxx Version 0.13.0
Loading...
Searching...
No Matches
smtpappender.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _LOG4CXX_NET_SMTP_H
19#define _LOG4CXX_NET_SMTP_H
20
21
25
26#if defined(_MSC_VER)
27 #pragma warning ( push )
28 #pragma warning ( disable: 4251 )
29#endif
30
31namespace log4cxx
32{
33namespace net
34{
45class LOG4CXX_EXPORT SMTPAppender : public AppenderSkeleton
46{
47 private:
48
49 private:
51 SMTPAppender& operator=(const SMTPAppender&);
52 static bool asciiCheck(const LogString& value, const LogString& label);
58 bool checkEntryConditions();
59
60 LogString to;
61 LogString cc;
62 LogString bcc;
63 LogString from;
64 LogString subject;
65 LogString smtpHost;
66 LogString smtpUsername;
67 LogString smtpPassword;
68 int smtpPort;
69 int bufferSize; // 512
70 bool locationInfo;
72 spi::TriggeringEventEvaluatorPtr evaluator;
73
74 public:
80
86 SMTPAppender(log4cxx::helpers::Pool& p);
87
92 SMTPAppender(spi::TriggeringEventEvaluatorPtr evaluator);
93
95
99 virtual void setOption(const LogString& option, const LogString& value);
100
105 virtual void activateOptions(log4cxx::helpers::Pool& p);
106
111 virtual void append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p);
112
113
114 virtual void close();
115
119 LogString getTo() const;
120
124 LogString getCc() const;
125
129 LogString getBcc() const;
130
131
135 virtual bool requiresLayout() const;
136
140 void sendBuffer(log4cxx::helpers::Pool& p);
141
142
146 LogString getEvaluatorClass();
147
151 LogString getFrom() const;
152
156 LogString getSubject() const;
157
158
163 void setFrom(const LogString& from);
164
169 void setSubject(const LogString& subject);
170
178 void setBufferSize(int bufferSize);
179
184 void setSMTPHost(const LogString& smtpHost);
185
189 LogString getSMTPHost() const;
190
195 void setSMTPPort(int port);
196
200 int getSMTPPort() const;
201
206 void setTo(const LogString& to);
207
212 void setCc(const LogString& to);
213
218 void setBcc(const LogString& to);
219
220
225 void setSMTPUsername(const LogString& newVal);
226
230 LogString getSMTPUsername() const;
231
236 void setSMTPPassword(const LogString& newVal);
237
241 LogString getSMTPPassword() const;
242
246 inline int getBufferSize() const
247 {
248 return bufferSize;
249 }
250
251
256 log4cxx::spi::TriggeringEventEvaluatorPtr getEvaluator() const;
257
262 void setEvaluator(log4cxx::spi::TriggeringEventEvaluatorPtr& trigger);
263
271 void setEvaluatorClass(const LogString& value);
272
277 void setLocationInfo(bool locationInfo);
278
282 bool getLocationInfo() const;
283}; // class SMTPAppender
284
286
287} // namespace net
288} // namespace log4cxx
289
290#if defined(_MSC_VER)
291 #pragma warning (pop)
292#endif
293
294#endif // _LOG4CXX_NET_SMTP_H
Implementation base class for all appenders.
Definition: appenderskeleton.h:46
CyclicBuffer is used by other appenders to hold instances of LoggingEvent for immediate or deferred d...
Definition: cyclicbuffer.h:35
Send an e-mail when a specific logging event occurs, typically on errors or fatal errors.
Definition: smtpappender.h:46
void setLocationInfo(bool locationInfo)
The LocationInfo option is provided for compatibility with log4j and has no effect in log4cxx.
log4cxx::spi::TriggeringEventEvaluatorPtr getEvaluator() const
Gets the current triggering evaluator.
bool getLocationInfo() const
Returns value of the LocationInfo option.
void setEvaluator(log4cxx::spi::TriggeringEventEvaluatorPtr &trigger)
Sets the triggering evaluator.
void setEvaluatorClass(const LogString &value)
The EvaluatorClass option takes a string value representing the name of the class implementing the sp...
LOG4CXX_PTR_DEF(SMTPAppender)
Definition: messagehandler.h:23
std::basic_string< logchar > LogString
Definition: logstring.h:66
#define LOG4CXX_CAST_ENTRY(Interface)
Definition: object.h:153
#define END_LOG4CXX_CAST_MAP()
Definition: object.h:147
#define DECLARE_LOG4CXX_OBJECT(object)
Definition: object.h:39
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition: object.h:159
#define BEGIN_LOG4CXX_CAST_MAP()
Definition: object.h:141