#define MDLOG_USER 0 #include "log4cpp/PatternLayout.hh" #include "log4cpp/Category.hh" #include "log4cpp/Appender.hh" #include "log4cpp/FileAppender.hh" #include "log4cpp/Layout.hh" #include "log4cpp/BasicLayout.hh" #include "log4cpp/Priority.hh" #include #include #include extern char *userLogPath; extern int tkDebugThreshold; using namespace log4cpp; Appender *app; char mdLogWork[256]; Category &root = Category::getRoot(), &md_core = Category::getInstance(std::string("md_core")), &md_dbug = Category::getInstance(std::string("md_dbug")), &md_devl = Category::getInstance(std::string("md_devl")); PatternLayout *layout; char *logPath,*mainLogFileName,xmlrpcLogFileName; void mdLogger::init(bool isMain) { const char *mainLogFileName = "drde-cliever.log", *actkLogFileName = "actk1_3_2.log"; #ifdef MDLOG_USER logPath = new char [strlen(userLogPath) + strlen(actkLogFileName) + 2]; strcpy(logPath,userLogPath); strcat(logPath,"/"); strcat(logPath,actkLogFileName); #if (MDLOG_USER == 1) thisConfig->xmlrpcLogpath = logPath; #endif #else logPath = new char [strlen(thisConfig->logPath) + strlen(mainLogFileName) + 1]; strcpy(logPath,thisConfig->logPath); strcat(logPath,"/"); strcat(logPath,mainLogFileName); thisConfig->logPath = logPath; #endif app = new FileAppender("default", logPath); layout = new PatternLayout(); layout->setConversionPattern("%d %p %c %x: %m%n"); app->setLayout(layout); root.addAppender(app); root.setPriority(Priority::ERROR); md_core.setPriority(Priority::INFO); md_core.setAdditivity(true); md_dbug.setPriority(Priority::DEBUG); md_dbug.setAdditivity(true); md_devl.setPriority(Priority::NOTSET); md_devl.setAdditivity(true); } void mdLogger::logN(int n, const char *format, ...) { char buff[1024]; void *args[4]; int nthArg = 0; va_list lm; va_start(lm,format); for (;nthArg tkDebugThreshold) return; va_start(lm,format); for (;nthArg