Gareth H
Gareth H

Reputation: 103

openam - log write authorization failure

I am attempting to write to a log. As per the below:

java.util.logging.Logger logger = com.sun.identity.log.Logger.getLogger("name");

I then do:

public void info(SSOToken token, String message) {
    if (this.logger != null) {
        java.util.logging.LogRecord value = null;
        if (token == null) {
            value = new LogRecord(Level.INFO, message);
        }
        else {
            value = new LogRecord(Level.INFO, message, token);
        }

        logger.log(value);
    }
}

But am getting an exception:

com.sun.identity.log.AMLogException: MagentoIdRepo:Log write authorization failure
    at com.sun.identity.log.Logger.validateLogBy(Logger.java:291)
    at com.sun.identity.log.Logger.log(Logger.java:363)
    at com.sun.identity.log.Logger.log(Logger.java:340)
    at com.sun.identity.log.Logger.log(Logger.java:270)

Any idea how i'd find out what user needs to be authed to log and how i'd auth them? as i presume thats what i need to do to fix the above.

Cheers.

Upvotes: 1

Views: 431

Answers (1)

Bernhard Thalmayr
Bernhard Thalmayr

Reputation: 2744

If you just want to do some debug logging you may use 'com.sun.identity.shared.debug.Debug' ...

private static Debug debug; 
debug = Debug.getInstance("someName");
if (debug.messageEnabled()) {
  debug.message(....);
}

if (debug.warningEnabled()) {
  debug.warning(...);
}

etc

If you really need the logger you started with special permissions have to be assinged to the identity which is related to the 'SSOToken'

Upvotes: 1

Related Questions