Search in sources :

Example 1 with LogSubject

use of org.apache.qpid.server.logging.LogSubject in project qpid-broker-j by apache.

the class AMQPConnectionActorTest method sendLogMessage.

private String sendLogMessage() {
    final String message = "test logging";
    Subject subject = new Subject(false, Collections.singleton(new ConnectionPrincipal(getConnection())), Collections.emptySet(), Collections.emptySet());
    Subject.doAs(subject, new PrivilegedAction<Object>() {

        @Override
        public Object run() {
            getEventLogger().message(new LogSubject() {

                @Override
                public String toLogString() {
                    return "[AMQPActorTest]";
                }
            }, new LogMessage() {

                @Override
                public String toString() {
                    return message;
                }

                @Override
                public String getLogHierarchy() {
                    return "test.hierarchy";
                }
            });
            return null;
        }
    });
    return message;
}
Also used : LogMessage(org.apache.qpid.server.logging.LogMessage) ConnectionPrincipal(org.apache.qpid.server.connection.ConnectionPrincipal) LogSubject(org.apache.qpid.server.logging.LogSubject) LogSubject(org.apache.qpid.server.logging.LogSubject) Subject(javax.security.auth.Subject)

Aggregations

Subject (javax.security.auth.Subject)1 ConnectionPrincipal (org.apache.qpid.server.connection.ConnectionPrincipal)1 LogMessage (org.apache.qpid.server.logging.LogMessage)1 LogSubject (org.apache.qpid.server.logging.LogSubject)1