|
|
Sponsor |
Re: Logging in templates?: msg#00073apache.logging.log4cxx.user
I don't think the problem is unsurmountable, but I haven't tried it myself. I'm just freehanding the following code, but maybe it will help you get started and you can post back to the list what works for you. I think you'd so something like: template <class T> class Example { Example() {} void doSomething() { LOG4CXX_DEBUG(getLogger(), "Hello, World"); } private: log4cxx::LoggerRef& getLogger() { static log4cxx::LoggerRef logger(log4cxx::Logger::getLogger( LOG4CXX_LOCATION.getClassName())); return logger; } }; The code fragment depends on the LocationInfo class introduced after 0.9.7 to get the class name. The class name may be returned as "" for early Microsoft compilers ( _MSC_VER < 1300). Please feel free to enhance include/log4cxx/spi/location/locationinfo.h if your compiler can return class location but the macros don't handle it. On Jan 30, 2005, at 10:51 AM, Daniel Einspanjer wrote: Does no one else have a problem with needing to log messages from
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Logging in templates?, Daniel Einspanjer |
|---|---|
| Next by Date: | Apache Log4cxx build fails with gcc 2.95 under Solaris 8, Ambarish Mitra |
| Previous by Thread: | Re: Logging in templates?, Daniel Einspanjer |
| Next by Thread: | timezone: TZ not defined!, Conway Allen |
| 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.
|