How to log dcmnet level info
Moderator: Moderator Team
How to log dcmnet level info
Hi,
my app uses dcmtk, and it has a debug mode where I log various info.
With 3.5.4 I used to include the low-level dcmtk debug info to the log, but with the latest snapshot I fail to see how with the new OFLog pattern.
How can I activate debugging of the dcmnet level APIs?
Thanks,
Normand
my app uses dcmtk, and it has a debug mode where I log various info.
With 3.5.4 I used to include the low-level dcmtk debug info to the log, but with the latest snapshot I fail to see how with the new OFLog pattern.
How can I activate debugging of the dcmnet level APIs?
Thanks,
Normand
Hmm,
to be more precise, I did this:
OFLog::configure(OFLogger::TRACE_LOG_LEVEL);
(I also tried DEBUG_LOG_LEVEL)
early in my code.
Then I invoke my app:
myApp >>someFile.txt
someFile.txt does not contain any low-level debug info. It contains very minimal info.
Yet if I add that same line to findscu.cc and recompile it, the output is very verbose.
What am I doing wrong? Is it the redirection?
Normand
to be more precise, I did this:
OFLog::configure(OFLogger::TRACE_LOG_LEVEL);
(I also tried DEBUG_LOG_LEVEL)
early in my code.
Then I invoke my app:
myApp >>someFile.txt
someFile.txt does not contain any low-level debug info. It contains very minimal info.
Yet if I add that same line to findscu.cc and recompile it, the output is very verbose.
What am I doing wrong? Is it the redirection?
Normand
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
The code line looks ok to be, but for findscu you should of course use the command line option "-ll trace" or an appropriate config file for the logger.
Btw, redirecting the output to a file is only the second best way. The best way would be something like filelog.cfg.
Btw, redirecting the output to a file is only the second best way. The best way would be something like filelog.cfg.
Well I don't want to rely on an external file to get debug info.
I'm stumped.
Adding this line to findscu.cc
OFLog::configure(OFLogger::TRACE_LOG_LEVEL);
gives me expected results (a detailed trace); while adding the same line of code to my app does not give me the same results.
What could be wrong?
I'm stumped.
Adding this line to findscu.cc
OFLog::configure(OFLogger::TRACE_LOG_LEVEL);
gives me expected results (a detailed trace); while adding the same line of code to my app does not give me the same results.
What could be wrong?
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
Maybe, the logger is reconfigured later in your program? Of course, you can also configure the logger completely from your program (see documentation).
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
-
- DCMTK Developer
- Posts: 2049
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
I only add one line of code, as I'm trying to have my app generate a very detailed trace of dcmtk activity:
OFLog::configure(OFLogger::TRACE_LOG_LEVEL);
yet invoking my app with a redirect like this:
myApp >>output.txt
results in a very minimal trace. I added the exact same line to findscu.cc and invoking the recompiled version of findscu with the same redirect as above results in a complete trace.
OFLog::configure(OFLogger::TRACE_LOG_LEVEL);
yet invoking my app with a redirect like this:
myApp >>output.txt
results in a very minimal trace. I added the exact same line to findscu.cc and invoking the recompiled version of findscu with the same redirect as above results in a complete trace.
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
It seems that we go round in circles ...
So here are a couple of precise questions - please answer them if appropriate:
So here are a couple of precise questions - please answer them if appropriate:
- Which operating system are you using and which shell (if there are multiple available)?
- Have you already tried to omit the redirect, i.e. output to the console? Please note the difference between stdout and stderr.
- Where in your code are you calling OFLog::configure(), in main() or in the constructor of a global variable?
- What do you mean by "very minimal trace"? Are you seeing log messages on "trace" level at all?
- From which DCMTK modules (i.e. loggers) are the messages you can see and which ones are missing?
- How do you output your own log messages (if any)?
-
- DCMTK Developer
- Posts: 120
- Joined: Thu, 2009-11-26, 08:15
I did a quick-and-dirty test. This was added at the beginning of "main()":
This does work as expected, however redirecting the output via ">>" doesn't work, because the output happens on stderr and not on stdout. If you want to redirect stderr, use "2>>".
For example:
Code: Select all
OFLog::configure(OFLogger::TRACE_LOG_LEVEL);
OFLOG_TRACE(OFLog::getLogger("dcmtk.dcmnet"), "test");
exit(0);
For example:
Code: Select all
$ echo test > test
$ cat abcdef 2>> test
$ cat test
test
cat: abcdef No such file or directory
>>Which operating system are you using and which shell (if there are multiple available)?
Windows XP.
>>Have you already tried to omit the redirect, i.e. output to the console? Please note the difference between stdout and stderr.
No. But as I said, the redirect works fine with findscu.
>>Where in your code are you calling OFLog::configure(), in main() or in the constructor of a global variable?
Much later than in the main(), it's in the initialization phase of the dialog that manages communication with PACS servers.
>>What do you mean by "very minimal trace"? Are you seeing log messages on "trace" level at all? and From which DCMTK modules (i.e. loggers) are the messages you can see and which ones are missing?
The trace only contains this:
Move SCU RQ: MsgID 5
Request:
# Dicom-Data-Set
# Used TransferSyntax: Unknown Transfer Syntax
(0008,0018) UI [1.2.840.113619.2.234.60338626539.1133.1228730122903.5543] # 56, 1 SOPInstanceUID
(0008,0052) CS [IMAGE] # 6, 1 QueryRetrieveLevel
(0020,000d) UI [1.2.840.113619.2.234.60338626539.1133.1228730110290.4974] # 56, 1 StudyInstanceUID
(0020,000e) UI [1.2.840.113619.2.234.60338626539.1133.1228730114510.5165] # 56, 1 SeriesInstanceUID
===================== INCOMING DIMSE MESSAGE ====================
Message Type : C-MOVE RSP
Message ID Being Responded To : 5
Affected SOP Class UID : MOVEStudyRootQueryRetrieveInformationModel
Remaining Suboperations : 0
Completed Suboperations : 1
Failed Suboperations : 0
Warning Suboperations : 0
Data Set : none
DIMSE Status : 0x0000: Success
======================= END DIMSE MESSAGE =======================
Everything from the dcmnet logger is missing.
>>How do you output your own log messages (if any)?
I do not use stderr or stdout, I open a log file and write directly there. My intention was not to share the same output as dcmtk.
Thanks
Windows XP.
>>Have you already tried to omit the redirect, i.e. output to the console? Please note the difference between stdout and stderr.
No. But as I said, the redirect works fine with findscu.
>>Where in your code are you calling OFLog::configure(), in main() or in the constructor of a global variable?
Much later than in the main(), it's in the initialization phase of the dialog that manages communication with PACS servers.
>>What do you mean by "very minimal trace"? Are you seeing log messages on "trace" level at all? and From which DCMTK modules (i.e. loggers) are the messages you can see and which ones are missing?
The trace only contains this:
Move SCU RQ: MsgID 5
Request:
# Dicom-Data-Set
# Used TransferSyntax: Unknown Transfer Syntax
(0008,0018) UI [1.2.840.113619.2.234.60338626539.1133.1228730122903.5543] # 56, 1 SOPInstanceUID
(0008,0052) CS [IMAGE] # 6, 1 QueryRetrieveLevel
(0020,000d) UI [1.2.840.113619.2.234.60338626539.1133.1228730110290.4974] # 56, 1 StudyInstanceUID
(0020,000e) UI [1.2.840.113619.2.234.60338626539.1133.1228730114510.5165] # 56, 1 SeriesInstanceUID
===================== INCOMING DIMSE MESSAGE ====================
Message Type : C-MOVE RSP
Message ID Being Responded To : 5
Affected SOP Class UID : MOVEStudyRootQueryRetrieveInformationModel
Remaining Suboperations : 0
Completed Suboperations : 1
Failed Suboperations : 0
Warning Suboperations : 0
Data Set : none
DIMSE Status : 0x0000: Success
======================= END DIMSE MESSAGE =======================
Everything from the dcmnet logger is missing.
>>How do you output your own log messages (if any)?
I do not use stderr or stdout, I open a log file and write directly there. My intention was not to share the same output as dcmtk.
Thanks
Who is online
Users browsing this forum: Bing [Bot] and 1 guest