#include "PhmsLogger.h" #include "Util.h" #include "AllObjectManagerUtil.h" #include "Poco/Logger.h" #include "Poco/FileChannel.h" #include "Poco/Message.h" #include "Poco/AutoPtr.h" #include "Poco/File.h" #include "Poco/DateTime.h" #include "Poco/DateTimeFormatter.h" #include "Poco/Timestamp.h" #include "Poco/Timezone.h" #include "Poco/Timespan.h" #include "Poco/Exception.h" #include #include #include using Poco::Logger; using Poco::FileChannel; using Poco::AutoPtr; using Poco::File; using Poco::Message; using Poco::Timestamp; using Poco::DateTime; using Poco::DateTimeFormatter; using Poco::Timestamp; using Poco::Timezone; using Poco::Timespan; using Poco::Exception; using std::ostringstream; CPhmsLogger* CPhmsLogger::m_pPhmsLogger = NULL; Mutex CPhmsLogger::m_mutex; CPhmsLogger::CPhmsLogger(void) { try { string stringWorkingDir = CUtil::GetCurrentAppDir(); File fileDir(stringWorkingDir+"log/NET_LOG/", "gbk"); fileDir.createDirectories(); File fileLog(stringWorkingDir+"log/NET_LOG/log_phms_netlib.log", "gbk"); fileLog.createFile(); AutoPtr pFileChannel = new FileChannel(fileLog.path()); #if defined(POCO_OS_FAMILY_UNIX) pFileChannel->setProperty(FileChannel::PROP_ROTATION, "1 M"); #else pFileChannel->setProperty(FileChannel::PROP_ROTATION, "1 days"); #endif pFileChannel->setProperty(FileChannel::PROP_ARCHIVE, "timestamp"); pFileChannel->setProperty(FileChannel::PROP_COMPRESS, "false"); #if defined(POCO_OS_FAMILY_UNIX) pFileChannel->setProperty(FileChannel::PROP_PURGECOUNT, "2"); #else pFileChannel->setProperty(FileChannel::PROP_PURGECOUNT, "30"); #endif pFileChannel->setProperty(FileChannel::PROP_TIMES, "utc"); Logger& logPhms = Logger::get("PHMS.NETLIB"); logPhms.setChannel(pFileChannel); logPhms.setLevel(Message::PRIO_ERROR); } catch(Exception& e) { std::cout<<"PhmsHttp:"<