FileChannel of Logger in Visual Studio 2010

Please post support and help requests here.
akeyliu
Posts: 1
Joined: 27 Nov 2013, 17:06

FileChannel of Logger in Visual Studio 2010

Postby akeyliu » 16 Dec 2013, 14:42

Hi, I'm using Visual Studio 2010 professional + Poco 1.4.6p2 in windows(win7 32).
And, I'm developing a Http Server using Poco::Net::HttpServer to accept HTTP request and send back HTTP Response.
The Http Server using windows console type of application.
But Only console logger will display the debug info NOT FileChannel.

Buiding Parameters for Visual Studio 2010 is Debug Win32 with command line compile format is :

"/ZI /nologo /W3 /WX- /Od /Oy- /D "WIN32" /D "_CONSOLE" /D "_DEBUG" /D "DEBUG" /D "WINVER=0x0601" /D "_WINDOWS" /D "POCO_STATIC" /D "_MBCS" /D "_UNICODE" /D "UNICODE" /Gm- /EHsc /RTC1 /MTd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fp"Debug\LOS.pch" /Fa"Debug\" /Fo"Debug\" /Fd"Debug\vc100.pdb" /Gd /analyze- /errorReport:queue "

major source code of logger are list below. Any idea for only console not FileChannel is work? Thanks.


#define LOS_LOGGER "FileLogger"

#define DEBUGSTR(s); {\
ostringstream o; \
LocalDateTime now; \
o << "[" << DateTimeFormatter::format(now, DateTimeFormat::SORTABLE_FORMAT) << "] [" << Process::id() << "][" << Thread::currentTid() << "][DEBUG][" << __FILE__ << "][" << __LINE__ << "][" << s << "]";\
Logger::get(LOS_LOGGER).debug(o.str());\
}
int main(int argc, char**argv)
{
std::string strLogFileName;
strLogFileName.append(argv[0]);
strLogFileName.append(".log");

AutoPtr<SplitterChannel> splitterChannel(new SplitterChannel());
AutoPtr<Channel> consoleChannel(new ConsoleChannel());
AutoPtr<Channel> fileChannel(new FileChannel(strLogFileName));
fileChannel->setProperty("rotation", "100");
fileChannel->setProperty("archive", "timestamp");
splitterChannel->addChannel(consoleChannel);
splitterChannel->addChannel(fileChannel);
AutoPtr<Formatter> formatter(new PatternFormatter("%h-%M-%S.%i: %t"));
AutoPtr<Channel> formattingChannel(new FormattingChannel(formatter, splitterChannel));

Logger::root().setChannel(formattingChannel);

#if defined DEBUG
Logger& fileLogger = Logger::create(LOS_LOGGER, formattingChannel, Message::PRIO_DEBUG);
#else
Logger& fileLogger = Logger::create(LOS_LOGGER, formattingChannel, Message::PRIO_INFORMATION);
#endif

LosHttpServer httpServer;
return(httpServer.run(argc, argv));
}

Return to “Support”

Who is online

Users browsing this forum: No registered users and 2 guests