Class StudyLogger


  • @Singleton
    public class StudyLogger
    extends java.lang.Object
    StudyLogger provides logging for JATOS studies. Each study gets it's own log usually created while the study is created.

    Major events are written into this log: - study creation/deletion/recreation - batch creation/deletion - study run start/stops/aborts - result data storing - NOT logging any user adding/removing

    Whenever the log entry handles result data a SHA-256 hash of the data is included in the log. If it exports files a SHA-256 hash of the content of the file is included in the log.

    The log uses charset ISO_8859_1.

    • Constructor Detail

      • StudyLogger

        public StudyLogger()
    • Method Detail

      • getFilename

        public java.lang.String getFilename​(Study study)
      • getPath

        public java.lang.String getPath​(Study study)
      • getRetiredFilename

        public java.lang.String getRetiredFilename​(Study study)
      • getRetiredPath

        public java.lang.String getRetiredPath​(Study study)
      • create

        public void create​(Study study)
      • retire

        public java.lang.String retire​(Study study)
      • log

        public void log​(Study study,
                        User user,
                        java.lang.String msg)
      • log

        public void log​(Study study,
                        User user,
                        java.lang.String msg,
                        Batch batch)
      • log

        public void log​(Study study,
                        User user,
                        java.lang.String msg,
                        org.apache.commons.lang3.tuple.Pair<java.lang.String,​java.lang.Object> additionalInfo)
      • log

        public void log​(Study study,
                        java.lang.String msg,
                        Worker worker)
      • log

        public void log​(StudyLink studyLink,
                        java.lang.String msg,
                        Worker worker)
      • logResultUploading

        public void logResultUploading​(java.nio.file.Path file,
                                       ComponentResult componentResult)
                                throws java.io.IOException
        Adds an entry to the study log: adds the hash of the file, component UUID, and the worker ID
        Parameters:
        file - File that will be stored
        Throws:
        java.io.IOException
      • logResultDataStoring

        public void logResultDataStoring​(ComponentResult componentResult,
                                         java.lang.String data,
                                         boolean append)
        Adds an entry to the study log: adds the hash of the result data, component UUID, and the worker ID
        Parameters:
        componentResult - ComponentResults that will be stored
      • logStudyDescriptionHash

        public void logStudyDescriptionHash​(Study study,
                                            User user)
      • readLogFile

        public akka.stream.javadsl.Source<akka.util.ByteString,​?> readLogFile​(Study study,
                                                                                    int entryLimit)
        Parameters:
        study - the study of which log will be read
        entryLimit - number of max entries will be read from the log