Apache Log4cxx  Version 1.5.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
26namespace LOG4CXX_NS
27{
28namespace net
29{
71class LOG4CXX_EXPORT SMTPAppender : public AppenderSkeleton
72{
73 private:
74 struct SMTPPriv;
75 SMTPAppender(const SMTPAppender&);
76 SMTPAppender& operator=(const SMTPAppender&);
77 static bool asciiCheck(const LogString& value, const LogString& label);
78
84 bool checkEntryConditions();
85
86 public:
87 DECLARE_LOG4CXX_OBJECT(SMTPAppender)
89 LOG4CXX_CAST_ENTRY(SMTPAppender)
92
93 SMTPAppender();
98 SMTPAppender(LOG4CXX_NS::helpers::Pool& p);
99
104 SMTPAppender(spi::TriggeringEventEvaluatorPtr evaluator);
105
106 ~SMTPAppender();
107
132 void setOption(const LogString& option, const LogString& value) override;
133
144 void activateOptions(helpers::Pool& p) override;
145
150 void append(const spi::LoggingEventPtr& event, helpers::Pool& p) override;
151
152
153 void close() override;
154
159
164
169
170
174 bool requiresLayout() const override;
175
179 void sendBuffer(LOG4CXX_NS::helpers::Pool& p);
180
181
186
191
196
197
202 void setFrom(const LogString& from);
203
208 void setSubject(const LogString& subject);
209
217 void setBufferSize(int bufferSize);
218
223 void setSMTPHost(const LogString& smtpHost);
224
229
234 void setSMTPPort(int port);
235
239 int getSMTPPort() const;
240
245 void setTo(const LogString& to);
246
251 void setCc(const LogString& to);
252
257 void setBcc(const LogString& to);
258
259
264 void setSMTPUsername(const LogString& newVal);
265
270
275 void setSMTPPassword(const LogString& newVal);
276
281
285 int getBufferSize() const;
286
287
292 LOG4CXX_NS::spi::TriggeringEventEvaluatorPtr getEvaluator() const;
293
298 void setEvaluator(LOG4CXX_NS::spi::TriggeringEventEvaluatorPtr& trigger);
299
307 void setEvaluatorClass(const LogString& value);
308
313 void setLocationInfo(bool locationInfo);
314
318 bool getLocationInfo() const;
319}; // class SMTPAppender
320
322
323} // namespace net
324} // namespace log4cxx
325
326#endif // _LOG4CXX_NET_SMTP_H
AppenderSkeleton(LOG4CXX_PRIVATE_PTR(AppenderSkeletonPrivate) priv)
Send an e-mail when a specific logging event occurs, typically when an ERROR level logging event is s...
Definition smtpappender.h:72
void setCc(const LogString &to)
The Cc option takes a string value which should be a comma separated list of e-mail address of the cc...
LogString getEvaluatorClass()
Returns value of the EvaluatorClass option.
void setLocationInfo(bool locationInfo)
The LocationInfo option is provided for compatibility with log4j and has no effect in log4cxx.
LogString getSMTPUsername() const
Returns value of the SMTPUsername option.
void setSMTPPassword(const LogString &newVal)
The SMTPPassword option takes a string value which should be a the password for the SMTP server.
LogString getSMTPHost() const
Returns value of the SMTPHost option.
log4cxx::spi::TriggeringEventEvaluatorPtr getEvaluator() const
Gets the current triggering evaluator.
void setSMTPHost(const LogString &smtpHost)
The SMTPHost option takes a string value which should be a the host name of the SMTP server that will...
void setSMTPUsername(const LogString &newVal)
The SMTPUsername option takes a string value which should be a the user name for the SMTP server.
LogString getTo() const
Returns value of the To option.
void close() override
Release any resources allocated within the appender such as file handles, network connections,...
void setSMTPPort(int port)
The SMTPPort option takes a string value which should be a the port of the SMTP server that will send...
LogString getSMTPPassword() const
Returns value of the SMTPPassword option.
bool getLocationInfo() const
Returns value of the LocationInfo option.
LogString getSubject() const
Returns value of the Subject option.
void setTo(const LogString &to)
The To option takes a string value which should be a comma separated list of e-mail address of the re...
int getSMTPPort() const
Returns value of the SMTPHost option.
LogString getCc() const
Returns value of the cc option.
void setEvaluator(log4cxx::spi::TriggeringEventEvaluatorPtr &trigger)
Sets the triggering evaluator.
void sendBuffer(log4cxx::helpers::Pool &p)
Send the contents of the cyclic buffer as an e-mail message.
void setFrom(const LogString &from)
The From option takes a string value which should be a e-mail address of the sender.
LogString getFrom() const
Returns value of the From option.
void setSubject(const LogString &subject)
The Subject option takes a string value which should be a the subject of the e-mail message.
void setOption(const LogString &option, const LogString &value) override
Set option to value.
int getBufferSize() const
Returns value of the BufferSize option.
void setEvaluatorClass(const LogString &value)
The EvaluatorClass option takes a string value representing the name of the class implementing the sp...
void setBufferSize(int bufferSize)
The BufferSize option takes a positive integer representing the maximum number of logging events to c...
void activateOptions(helpers::Pool &p) override
Activate the options that were previously set with calls to option setters.
LogString getBcc() const
Returns value of the bcc option.
void setBcc(const LogString &to)
The Bcc option takes a string value which should be a comma separated list of e-mail address of the b...
bool requiresLayout() const override
The SMTPAppender requires a Layout.
void append(const spi::LoggingEventPtr &event, helpers::Pool &p) override
Perform SMTPAppender specific appending actions, mainly adding the event to a cyclic buffer and check...
Definition propertysetter.h:27
Definition smtpappender.h:29
LOG4CXX_PTR_DEF(SMTPAppender)
Definition appender.h:30
std::basic_string< logchar > LogString
Definition logstring.h:60
#define LOG4CXX_CAST_ENTRY(Interface)
Definition object.h:158
#define END_LOG4CXX_CAST_MAP()
Definition object.h:152
#define DECLARE_LOG4CXX_OBJECT(object)
Definition object.h:43
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition object.h:164
#define BEGIN_LOG4CXX_CAST_MAP()
Definition object.h:146