Search in sources :

Example 1 with AssessmentSessionAuditOLog

use of org.olat.ims.qti21.manager.audit.AssessmentSessionAuditOLog in project OpenOLAT by OpenOLAT.

the class QTI21ServiceImpl method getAssessmentSessionAuditLogger.

@Override
public AssessmentSessionAuditLogger getAssessmentSessionAuditLogger(AssessmentTestSession session, boolean authorMode) {
    if (authorMode) {
        return new AssessmentSessionAuditOLog();
    }
    if (session.getIdentity() == null && StringHelper.containsNonWhitespace(session.getAnonymousIdentifier())) {
        return new AssessmentSessionAuditOLog();
    }
    try {
        File auditLog = getAssessmentSessionAuditLogFile(session);
        FileOutputStream outputStream = new FileOutputStream(auditLog, true);
        return new AssessmentSessionAuditFileLog(outputStream);
    } catch (IOException e) {
        log.error("Cannot open the user specific log audit, fall back to OLog", e);
        return new AssessmentSessionAuditOLog();
    }
}
Also used : AssessmentSessionAuditFileLog(org.olat.ims.qti21.manager.audit.AssessmentSessionAuditFileLog) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) File(java.io.File) AssessmentSessionAuditOLog(org.olat.ims.qti21.manager.audit.AssessmentSessionAuditOLog)

Example 2 with AssessmentSessionAuditOLog

use of org.olat.ims.qti21.manager.audit.AssessmentSessionAuditOLog in project openolat by klemens.

the class QTI21ServiceImpl method getAssessmentSessionAuditLogger.

@Override
public AssessmentSessionAuditLogger getAssessmentSessionAuditLogger(AssessmentTestSession session, boolean authorMode) {
    if (authorMode) {
        return new AssessmentSessionAuditOLog();
    }
    if (session.getIdentity() == null && StringHelper.containsNonWhitespace(session.getAnonymousIdentifier())) {
        return new AssessmentSessionAuditOLog();
    }
    try {
        File auditLog = getAssessmentSessionAuditLogFile(session);
        FileOutputStream outputStream = new FileOutputStream(auditLog, true);
        return new AssessmentSessionAuditFileLog(outputStream);
    } catch (IOException e) {
        log.error("Cannot open the user specific log audit, fall back to OLog", e);
        return new AssessmentSessionAuditOLog();
    }
}
Also used : AssessmentSessionAuditFileLog(org.olat.ims.qti21.manager.audit.AssessmentSessionAuditFileLog) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) File(java.io.File) AssessmentSessionAuditOLog(org.olat.ims.qti21.manager.audit.AssessmentSessionAuditOLog)

Aggregations

File (java.io.File)2 FileOutputStream (java.io.FileOutputStream)2 IOException (java.io.IOException)2 AssessmentSessionAuditFileLog (org.olat.ims.qti21.manager.audit.AssessmentSessionAuditFileLog)2 AssessmentSessionAuditOLog (org.olat.ims.qti21.manager.audit.AssessmentSessionAuditOLog)2