Apache Log4cxx  Version 2.0.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
97 SMTPAppender();
98
103 SMTPAppender(const spi::TriggeringEventEvaluatorPtr& evaluator);
104
105 ~SMTPAppender();
106
131 void setOption(const LogString& option, const LogString& value) override;
132
133 using spi::OptionHandler::activateOptions;
144 void activateOptions( ) override;
145
150 void append( const spi::LoggingEventPtr& event ) override;
151
156
161
166
171
176
181
182
187 void setFrom(const LogString& from);
188
193 void setSubject(const LogString& subject);
194
195 static const int MaxBufferedEventCount = 10000000;
203 void setBufferSize(int newValue);
204
209 void setSMTPHost(const LogString& smtpHost);
210
215
220 void setSMTPPort(int port);
221
225 int getSMTPPort() const;
226
231 void setTo(const LogString& to);
232
237 void setCc(const LogString& to);
238
243 void setBcc(const LogString& to);
244
245
250 void setSMTPUsername(const LogString& newVal);
251
256
261 void setSMTPPassword(const LogString& newVal);
262
267
271 int getBufferSize() const;
272
273
278 LOG4CXX_NS::spi::TriggeringEventEvaluatorPtr getEvaluator() const;
279
284 void setEvaluator(const spi::TriggeringEventEvaluatorPtr& trigger);
285
293 void setEvaluatorClass(const LogString& value);
294
299 void setLocationInfo(bool locationInfo);
300
304 bool getLocationInfo() const;
305}; // class SMTPAppender
306
308
309} // namespace net
310} // namespace log4cxx
311
312#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 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.
static const int MaxBufferedEventCount
Definition smtpappender.h:195
bool getLocationInfo() const
Returns value of the LocationInfo option.
LogString getSubject() const
Returns value of the Subject option.
void setEvaluator(const spi::TriggeringEventEvaluatorPtr &trigger)
Sets the triggering evaluator.
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 setBufferSize(int newValue)
use newValue, an integer in the range 1 to 10 million, as the maximum number of logging events to col...
void append(const spi::LoggingEventPtr &event) override
Perform SMTPAppender specific appending actions, mainly adding the event to a cyclic buffer and check...
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
Override this method to 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...
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...
void activateOptions() override
Activate the options that were previously set with calls to option setters.
LOG4CXX_PTR_DEF(JSONSocketAppender)
Definition appender.h:30
std::basic_string< logchar > LogString
Definition logstring.h:51
#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:41
#define LOG4CXX_CAST_ENTRY_CHAIN(Interface)
Definition object.h:159
#define BEGIN_LOG4CXX_CAST_MAP()
Definition object.h:141