Change CTP logger level with code?

61 views
Skip to first unread message

95mariag...@gmail.com

unread,
Oct 15, 2021, 10:18:15 AM10/15/21
to RSNA MIRC CTP/TFS User Group
Hello,

Is it possible to change the log level of a CTP class other than through the admin interface? By editing a specific file or using code for example?
I thought at first that the file log4j.properties registered the logger level for each class but it seems it is not the case. Where does this information is stored and can I edit it manually?

Also, does a documentation exist on which class to enable logging for each stage?

Thank you.

Sincerely,

Clément

karine....@sfr.fr

unread,
Nov 14, 2021, 10:10:38 AM11/14/21
to RSNA MIRC CTP/TFS User Group
Hello John and all,

Any response to this question from my colleague Clément?
Thanks a lot!

Karine

John Perry

unread,
Nov 14, 2021, 11:01:33 AM11/14/21
to rsnas-ctpmir...@googlegroups.com
Karine:
 
The CTP/log4j.properties file can be used to force the logger levels if you want. Near the bottom of the file, you will see lots of commented-out examples that I keep there for use when I'm testing:
 
#log4j.logger.org.rsna.ctp.stdstages.PollingHttpImportService = DEBUG
#log4j.logger.org.rsna.ctp.stdstages.PolledHttpExportService = DEBUG
#log4j.logger.org.rsna.ctp.servlets.PolledServlet = DEBUG
#log4j.logger.org.rsna.ctp.pipeline.Pipeline = DEBUG
#log4j.logger.org.rsna.ctp.pipeline.AbstractImportService = DEBUG
 
#log4j.logger.org.rsna.ctp.stdstages.dicom.DicomStorageSCP = DEBUG
#log4j.logger.org.rsna.ctp.stdstages.FileStorageService = DEBUG;
 
#log4j.logger.org.rsna.ctp.stdstages.DicomPixelAnonymizer = DEBUG
#log4j.logger.org.rsna.ctp.stdstages.anonymizer.dicom.DICOMPixelAnonymizer = DEBUG
#log4j.logger.org.rsna.ctp.stdstages.anonymizer.dicom.PrivateTagIndex = DEBUG
 
#log4j.logger.org.rsna.ctp.pipeline.AbstractExportService = DEBUG
#log4j.logger.org.rsna.ctp.pipeline.AbstractQueuedExportService = DEBUG
#log4j.logger.org.rsna.ctp.pipeline.AbstractImportService = DEBUG
#log4j.logger.org.rsna.ctp.stdstages.HttpImportService = DEBUG
#log4j.logger.org.rsna.ctp.stdstages.HttpExportService = DEBUG
#log4j.logger.org.rsna.service.HttpService = DEBUG
#log4j.logger.org.rsna.ctp.stdstages.DicomSTOWRSExportService = DEBUG
#log4j.logger.org.rsna.ctp.stdstages.DicomSTOWRSImportService = DEBUG
 
You can use those as examples (just don't include the hashtag), but you will have to know the fully qualified class name of the class whose logger level you want to set.
 
You can set the logger level of a class programmatically if you are writing your own code. Look at the code of the doPost method in LoggerLevelServlet for an example. You can get the code at https://github.com/johnperry/Util/blob/master/source/java/org/rsna/servlets/LoggerLevelServlet.java.
 
JP
--
You received this message because you are subscribed to the Google Groups "RSNA MIRC CTP/TFS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rsnas-ctpmirc-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rsnas-ctpmirc-user-group/17103e65-8a58-4bba-ba9e-f4dccd0bad82n%40googlegroups.com.

karine....@sfr.fr

unread,
Nov 14, 2021, 12:26:15 PM11/14/21
to RSNA MIRC CTP/TFS User Group
Thank you John! We will look into this. 
I assume that you need to restart CTP after editing the log4j.properties file?

Thanks!
Karine

John Perry

unread,
Nov 14, 2021, 1:09:38 PM11/14/21
to rsnas-ctpmir...@googlegroups.com
Karine:
 
If you change log4j.properties, I think you must restart CTP. That's what I've always done, anyway.
 
Obviously, if you change a logger level programmatically, that change takes effect immediately.
Reply all
Reply to author
Forward
0 new messages