问题:自定义Appender输出DCMTK的oflog

阅读更多

在我调试DCMTK的DcmNet过程中,发现在Oflog中,DCMTK的日志只能输出到控制台应用程序的console窗口,或者输出到文件中,无法单独获取日志信息。

如果想输出Gui项目中,需要自己继承log4cpus,自定义Appender实现输出log。

如果我实现了,再过来更新我的代码。

已解决该问题:【原创】自定义Appender类,输出DCMTK日志

 

Author Message
  Post subject: log4cplus to memory
Post Posted: Thu, 2011-10-06, 17:44 
Offline

Joined: Thu, 2011-10-06, 15:48
Posts: 6
Location: Österreich
Hi all 

Is it possible to redirect the log of dcmtk to memory i.e. string ? I only found the FileAppender. 

Thanks


Report this post
Top
  Profile  
Reply with quote  
  Post subject:
Post Posted: Thu, 2011-10-06, 17:57 
Offline
DCMTK Developer

Joined: Tue, 2011-05-03, 15:38
Posts: 720
What about using the DCMTK_GUI macro as described in the  documentation? 

Alternatively, you could write your own  appender based on the " oflog" framework ...


Report this post
Top
  Profile  
Reply with quote  
  Post subject:
Post Posted: Thu, 2011-10-06, 18:12 
Offline

Joined: Thu, 2011-10-06, 15:48
Posts: 6
Location: Österreich
Wow that was fast -> thanks 

You are right, i am about to use dcmtk library's in my own GUI Application but the DCMTK_GUI macro is not an option for me, the user should have both 
the string stream and a console output. 

will look in the source how you did the string stream and then write my own appender 

thx


Report this post
Top
  Profile  
Reply with quote  
  Post subject:
Post Posted: Sat, 2011-10-08, 12:56 
Offline

Joined: Thu, 2011-10-06, 15:48
Posts: 6
Location: Österreich
Hi 

Just to let you know, i did it with the preprocessor macro 

Code:
#define ofConsole (OFConsole::instance())


and then switch with a pointer to COUT, either from GUI stringstream or console ostream, works like a charm  :)


Report this post
Top
  Profile  
Reply with quote  
Display posts from previous: All posts 1 day 7 days 2 weeks 1 month 3 months 6 months 1 year Sort by Author Post time Subject Ascending Descending 

你可能感兴趣的:(DCMTK,oflog,自定义输出,cout,调试)