C++ logging library. It is extremely powerful, extendable, light-weight, fast performing, thread and type safe and consists of many built-in features. It provides ability to write logs in your own customized format. It also provide support for logging your classes, third-party libraries, STL and third-party containers etc.
MIT License
3.75k
stars
918
forks
source link
In Multi-threading,if define ELPP_THREAD_SAFE, error:Segmentation fault (core dumped) #813
My simple code is as follows:
include
include
define ELPP_THREAD_SAFE
include "easylogging++.h"
INITIALIZE_EASYLOGGINGPP pthread_t task1; pthread_t task2; using namespace std; void task1_thread(void arg) { unsigned int count = 0; LOG(INFO) << "In task1"; while(1) { count++; if(count>4500) { LOG(INFO) << "In task1 count = "<<count; count = 0; } usleep(1000); } }
void task2_thread(void arg) { unsigned int count = 0; LOG(INFO) << "In task2"; while(1) { count++; if(count>4500) { LOG(INFO) << "In task2 count = "<<count; count = 0; } usleep(1000); } }
int main(int argc, char *argv[]) {
if 1
endif
}
g++ main.cpp easylogging++.cc easylogging++.h -std=c++11 -lpthread -o log_test ./log_test
error: Segmentation fault (core dumped)