LOG file for non command line app

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
SIMONP
Posts: 28
Joined: Fri, 2016-06-17, 11:11

LOG file for non command line app

#1 Post by SIMONP »

We are using DcmSCU in our app.
How to setup a logfile to log all DCMTK errors ?
Thanks in advance

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: LOG file for non command line app

#2 Post by Michael Onken »


SIMONP
Posts: 28
Joined: Fri, 2016-06-17, 11:11

Re: LOG file for non command line app

#3 Post by SIMONP »

Thanks for your reply Michael...
But logging which you pointed to provides logging
mechanism for command line dcmtk tools.
What if we use DCMTK APIs from within our app ?
How to use that script which resirest DCMTK error msgs output
to the file ?
Thanks again

Simon

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: LOG file for non command line app

#4 Post by Michael Onken »

Hi,

I am not sure I understand you correctly. The howto I pointed you to shows how to configure the logging in DCMTK command line tools as well as DCMTK libraries. So every log output that is produced by DCMTK code can be controlled by the configuration measures demonstrated.

Or do you want to do something else?

Best,
Michael

SIMONP
Posts: 28
Joined: Fri, 2016-06-17, 11:11

Re: LOG file for non command line app

#5 Post by SIMONP »

Michael...

Thanks again.
Maybe my explanation is poor...
config file for logging is placed on command line "...--log--config logfile.cfg...".
The question how to apply this config file (logfile.cfg) if it is not a command line tool ?

Thanks again

Simon

Michael Onken
DCMTK Developer
Posts: 2049
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: LOG file for non command line app

#6 Post by Michael Onken »

Hi Simon,

ah, got it -- well, that's actually a good question :)

Our command line tools call oflog.cc's configureFromCommandLine(...) function, which extracts the logging configuration file (if provided on the command line) and then creates the related logging configuration via creating a dcmtk::log4cplus::helpers::Properties(log_file). The config is then is then applied via some further calls to the logging library.

You can create your own own dcmtk::log4cplus::helpers::Properties but I dont't see a way either to apply it from code if not using mentioned configureFromCommandLine() call. Maybe one of my DCMTK colleagues knows a way. If not, it may be worth adding a related call to the oflog.cc interface.

For now, you could (mis)use the configureFromCommandLine() call by creating fake parameters OFCommandline, OFConsoleApplication, and log level parameters. OFCommandline must then include the "--log-config" option with the file that you want to load.

Hope that helps,
Michael

SIMONP
Posts: 28
Joined: Fri, 2016-06-17, 11:11

Re: LOG file for non command line app

#7 Post by SIMONP »

Michael...

Thanks again for all your quick replies.
Will try to implement your suggestions to fake ODCommandLine etc...

could you please make me a huge favor ans reply to my other post regarding
"PACS to PACS DICOM transfer" ?

Thanks

Simon

PS I owe you a lunch (at least). Come to Boston :)

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest