|
|
Sponsor |
Re: Re[2]: Unicode Logging questions: msg#00010apache.logging.log4cxx.user
On Feb 1, 2005, at 11:54 PM, Martin Lechner wrote: Hello Curt, With the current CVS HEAD, neither is acceptable The log4cxx 0.9.7 macros were forced to create a stream to support this syntax even if the argument was just a char* or std::string. The current CVS's provides a stream wrapper for logging in <log4cxx/stream.h>. The logstream class provides STL stream-like semantics on top of a logger. The implementation supports short-circuiting expressions when the level is not enabled. Due to the non-atomic nature of stream operations, logstream is not thread-safe (and can't be made so), so do not share it between threads. The expected usage pattern is to have a static LoggerPtr as a class member and logstream wrappers to be created on method entry. In addition, you can insert either wchar_t or char strings into logstream, it will transcode on the fly. There is a sample in examples/stream.cpp and unit tests in tests/src/streamtestcase.cpp. Your code fragment would should look something like: #include <log4cxx/stream.h> class MyClass { private static log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("MyClass")); public doSomething() { log4cxx::logstream logstream(logger, log4cxx::Level::DEBUG); logstream << L"hello" << someWstring << 5 << LOG4CXX_ENDMSG; } } There has been a substantial amount of debate on the topic and still profoundly different opinions on the desirable semantics which I do not think can be reconciled in one implementation. I don't expect that the semantics of log4cxx::logstream will change, but am open to implementation improvements and am willing to consider including other implementations, but I think we need to gather more experience and have more platforms to test before doing that. You may want to review the list dev archives and/or the Jira entry (http://issues.apache.org/jira/browse/LOGCXX-18)
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re[2]: Unicode Logging questions, Martin Lechner |
|---|---|
| Next by Date: | RE: Re[2]: Unicode Logging questions, LECHNER Martin |
| Previous by Thread: | Re[2]: Unicode Logging questions, Martin Lechner |
| Next by Thread: | RE: Re[2]: Unicode Logging questions, LECHNER Martin |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |
Home | sitemap
| advertise | OSDir is
an inevitable website.
|