STDOUT vs STDERR

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
gotmikhail
Posts: 3
Joined: Thu, 2019-01-10, 15:10

STDOUT vs STDERR

#1 Post by gotmikhail »

Is there any particular reason why all output is directed to STDERR?

Or, is there a chance I'm doing something wrong on my machine. Yesterday I downloaded the latest, compiled, and installed with the same results on Fedora 29

J. Riesmeier
DCMTK Developer
Posts: 2504
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: STDOUT vs STDERR

#2 Post by J. Riesmeier »

It would be helpful if you could provide an example that shows what you did or tried to do, e.g. are your talking about the log output, the console output of tools such as dcmdump...?

gotmikhail
Posts: 3
Joined: Thu, 2019-01-10, 15:10

Re: STDOUT vs STDERR

#3 Post by gotmikhail »

I could be going about this the wrong way, but here's a simple example:

Let's run `findscu` from terminal (anonymized, so bogus IPs, etc, ignore) in verbose:

Code: Select all

findscu -S -v -k 0010,0010 -k 0010,0020 -k 0010,0030 -k 0008,0020 -k 0008,0030 -k 0008,0061=SR -k 0008,0050=ABCDE -k 0020,000d -aec OTHERAE xx.xx.xx.xx 104 -aet MYAET 
Gives us:

Code: Select all

I: Requesting Association
I: Association Accepted (Max Send PDV: 16340)
I: Sending Find Request (MsgID 1)
I: Request Identifiers:
I: 
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Explicit
I: (0008,0020) DA (no value available)                     #   0, 0 StudyDate
I: (0008,0030) TM (no value available)                     #   0, 0 StudyTime
I: (0008,0050) SH [ABCDE]                              #  10, 1 AccessionNumber
I: (0008,0052) CS [STUDY]                                  #   6, 1 QueryRetrieveLevel
I: (0008,0061) CS [SR]                                     #   2, 1 ModalitiesInStudy
I: (0010,0010) PN (no value available)                     #   0, 0 PatientName
I: (0010,0020) LO (no value available)                     #   0, 0 PatientID
I: (0010,0030) DA (no value available)                     #   0, 0 PatientBirthDate
I: (0020,000d) UI (no value available)                     #   0, 0 StudyInstanceUID
I: 
I: ---------------------------
I: Find Response: 1 (Pending)
I: 
I: # Dicom-Data-Set
I: # Used TransferSyntax: Little Endian Implicit
I: (0008,0005) CS [ISO_IR 100]                             #  10, 1 SpecificCharacterSet
I: (0008,0020) DA [20000101]                               #   8, 1 StudyDate
I: (0008,0030) TM [0]                                  #  10, 1 StudyTime
I: (0008,0050) SH [ABCDE]                             #  10, 1 AccessionNumber
I: (0008,0052) CS [STUDY ]                                 #   6, 1 QueryRetrieveLevel
I: (0008,0054) AE [OTHERAET]                         #  14, 1 RetrieveAETitle
I: (0008,0056) CS [ONLINE]                                 #   6, 1 InstanceAvailability
I: (0008,0061) CS [SR]                                     #   2, 1 ModalitiesInStudy
I: (0010,0010) PN [Last^First ]             #  26, 1 PatientName
I: (0010,0020) LO [WXYZ]                                 #   6, 1 PatientID
I: (0010,0030) DA [19000101]                               #   8, 1 PatientBirthDate
I: (0020,000d) UI [1.2.840.xxx]                             #  56, 1 StudyInstanceUID
I: (0088,0130) SH (no value available)                     #   0, 0 StorageMediaFileSetID
I: (0088,0140) UI (no value available)                     #   0, 0 StorageMediaFileSetUID
I: 
I: Received Final Find Response (Success)
I: Releasing Association
No errors, but all output is being sent to STDERR. Route STDERR to `/dev/null`, and you have no output to terminal.

Code: Select all

findscu -S -v -k 0010,0010 -k 0010,0020 -k 0010,0030 -k 0008,0020 -k 0008,0030 -k 0008,0061=SR -k 0008,0050=ABCDE -k 0020,000d -aec OTHERAE xx.xx.xx.xx 104 -aet MYAET 2>/dev/null
No output
Redirect STDOUT & STDERR into their own files,

Code: Select all

findscu -S -v -k 0010,0010 -k 0010,0020 -k 0010,0030 -k 0008,0020 -k 0008,0030 -k 0008,0061=SR -k 0008,0050=ABCDE -k 0020,000d -aec OTHERAE xx.xx.xx.xx 104 -aet MYAET 1> stdout.txt 2>stderr.txt
And all the results are in `stderr.txt`

Results are all the same when not using verbose, but the only difference is the "pre-query" info.

J. Riesmeier
DCMTK Developer
Posts: 2504
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: STDOUT vs STDERR

#4 Post by J. Riesmeier »

In contrast to e.g. dcmdump, findscu has no textual output by default. What you see in the info lines (starting with "I:") is the log output, which is usually directed to stderr/cerr. Of course, you can change this default with an appropriate logger configuration (see "oflog/etc/logger.cfg" for an example).

Post Reply

Who is online

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