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

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

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

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

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

 

AuthorMessage
  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 posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值