-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbusiness_error_info.h
More file actions
52 lines (48 loc) · 1.04 KB
/
business_error_info.h
File metadata and controls
52 lines (48 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef MONITOR_BUSINESS_ERROR_INFO_H
#define MONITOR_BUSINESS_ERROR_INFO_H
#include <zmq.hpp>
#include <log4cxx/logger.h>
#include <log4cxx/dailyrollingfileappender.h>
#include <log4cxx/basicconfigurator.h>
#include <log4cxx/patternlayout.h>
#include "basethread.h"
class BusinessErrorInfo: public BaseThread
{
public:
BusinessErrorInfo(zmq::context_t *context):context_(context)
{
sock_recv_ = NULL;
}
~BusinessErrorInfo()
{
if(NULL != sock_recv_)
{
sock_recv_->close();
delete sock_recv_;
sock_recv_ = NULL;
}
if(NULL != pattern_layout_)
{
delete pattern_layout_;
pattern_layout_ = 0;
}
if(NULL != appender_)
{
delete appender_;
appender_ = 0;
}
};
void Init();
void RunThreadFunc();
private:
void InitZMQ();
void InitLog();
void WriteToLog(const std::string str);
zmq::context_t *context_;
zmq::socket_t *sock_recv_;
static log4cxx::LoggerPtr logger_;
log4cxx::LoggerPtr logger_business_error_;
log4cxx::PatternLayoutPtr pattern_layout_;
log4cxx::DailyRollingFileAppenderPtr appender_;
};
#endif