NeoPZ
pzlog.cpp
Go to the documentation of this file.
1 
6 #include "pzlog.h"
7 #include <sys/stat.h>
8 #include <iostream>
9 
10 #ifdef LOG4CXX
11 pthread_mutex_t glogmutex = PTHREAD_MUTEX_INITIALIZER;
12 #endif
13 
15 {
16  std::string path;
17  std::string configfile;
18 #ifdef PZSOURCEDIR
19  path = PZSOURCEDIR;
20  path += "/Util/";
21 #else
22  path = "";
23 #endif
24  configfile = path;
25  configfile += "log4cxx.cfg";
26 
27 #ifndef WIN32
28  int res = mkdir ("LOG", S_IRWXU | S_IXGRP | S_IRGRP | S_IXOTH | S_IROTH);
29  // Wether the error happen again, the problem can to be permission, then a message is printed
30  if(res) {
31  struct stat result;
32  res = stat ("LOG",&result);
33  if(res) std::cout << "Error in mkdir : " << res << " permission denied." << std::endl;
34  }
35 #endif
36 
37  std::cout << "Logfile " << configfile << std::endl;
38  InitializePZLOG(configfile);
39 }
40 
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
string res
Definition: test.py:151
void InitializePZLOG()
Initializes log file for log4cxx with commom name log4cxx.cfg.
Definition: pzlog.cpp:14