|
|
Sponsor |
RE: Re[2]: Unicode Logging questions: msg#00011apache.logging.log4cxx.user
Thanks a lot for your help. This answers a few questions, and gives new ideas;) At the moment I have Logging turned off by redefining the macros. I think I will try to wrap the logstream isid a macro and see what happen. Beside: Thanks for doing such a great work with log4cxx. I really like it - and its seems to get even better ;) Best regards ML > -----Original Message----- > From: Curt Arnold [mailto:carnold@xxxxxxxxxx] > Sent: Mittwoch, 02. Februar 2005 07:43 > To: Log4CXX User > Subject: Re: Re[2]: Unicode Logging questions > > > On Feb 1, 2005, at 11:54 PM, Martin Lechner wrote: > > > Hello Curt, > > > > Thanks for the info and tips. > > I can live with the \u representation for the moment, when > I know that > > there will be readable output in the future. > > > > But I have another small question: > > I am currently replacing in an application std::string with > > std::wstring Before it was possible to log in streams, but with > > wstrings its not possible at the moment. > > > > works: LOG4CXX_DEBUG(loggerPtr_, "hello" << someString << 5 > ); works > > not: LOG4CXX_DEBUG(loggerPtr_, L"hello" << someWtring << 5 ); > > > > Is this planned or do I have to use other ways to log things like > > this? > > > > 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: Re[2]: Unicode Logging questions, Curt Arnold |
|---|---|
| Next by Date: | Re: Re[2]: Unicode Logging questions, Curt Arnold |
| Previous by Thread: | Re: Re[2]: Unicode Logging questions, Curt Arnold |
| Next by Thread: | Re: Re[2]: Unicode Logging questions, Curt Arnold |
| 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.
|