在我调试DCMTK的DcmNet过程中,发现在Oflog中,DCMTK的日志只能输出到控制台应用程序的console窗口,或者输出到文件中,无法单独获取日志信息。
如果想输出Gui项目中,需要自己继承log4cpus,自定义Appender 实现输出log。
如果我实现了,再过来更新我的代码。
已解决该问题:【原创】自定义Appender类,输出DCMTK日志
Author Message AreaScout
Post subject: log4cplus to memory
Posted: Thu, 2011-10-06, 17:44
Joined: Thu, 2011-10-06, 15:48Posts: 6Location: Österreich
Hi all
Is it possible to redirect the log of dcmtk to memory i.e. string ? I only found the FileAppender.
Thanks
Top
J. Riesmeier
Post subject:
Posted: Thu, 2011-10-06, 17:57
DCMTK Developer
Joined: Tue, 2011-05-03, 15:38Posts: 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 ...
Top
AreaScout
Post subject:
Posted: Thu, 2011-10-06, 18:12
Joined: Thu, 2011-10-06, 15:48Posts: 6Location: Ö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
Top
AreaScout
Post subject:
Posted: Sat, 2011-10-08, 12:56
Joined: Thu, 2011-10-06, 15:48Posts: 6Location: Ö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
Top
Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending