Search in sources :

Example 1 with LogResponse

use of com.sun.identity.idsvcs.LogResponse in project OpenAM by OpenRock.

the class IdentityServicesImpl method log.

@Override
public LogResponse log(Token app, Token subject, String logName, String message) throws AccessDenied, TokenExpired, GeneralFailure {
    if (app == null) {
        throw new AccessDenied("No logging application token specified");
    }
    SSOToken appToken;
    SSOToken subjectToken;
    appToken = getSSOToken(app);
    subjectToken = subject == null ? appToken : getSSOToken(subject);
    try {
        LogRecord logRecord = new LogRecord(java.util.logging.Level.INFO, message, subjectToken);
        //TODO Support internationalization via a resource bundle specification
        Logger logger = (Logger) Logger.getLogger(logName);
        logger.log(logRecord, appToken);
        logger.flush();
    } catch (AMLogException e) {
        debug.error("IdentityServicesImpl:log", e);
        throw new GeneralFailure(e.getMessage());
    }
    return new LogResponse();
}
Also used : LogResponse(com.sun.identity.idsvcs.LogResponse) SSOToken(com.iplanet.sso.SSOToken) LogRecord(com.sun.identity.log.LogRecord) GeneralFailure(com.sun.identity.idsvcs.GeneralFailure) AMLogException(com.sun.identity.log.AMLogException) Logger(com.sun.identity.log.Logger) AccessDenied(com.sun.identity.idsvcs.AccessDenied)

Aggregations

SSOToken (com.iplanet.sso.SSOToken)1 AccessDenied (com.sun.identity.idsvcs.AccessDenied)1 GeneralFailure (com.sun.identity.idsvcs.GeneralFailure)1 LogResponse (com.sun.identity.idsvcs.LogResponse)1 AMLogException (com.sun.identity.log.AMLogException)1 LogRecord (com.sun.identity.log.LogRecord)1 Logger (com.sun.identity.log.Logger)1