8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2009 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: OpenSSOLogger.java,v 1.1 2009/10/22 21:03:33 veiming Exp $
be56b0499bf4793872f73b8042ffacb3cf7e575eMark de Reeper * Portions Copyrighted 2015 ForgeRock AS.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.entitlement.log.ELogRecord;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.entitlement.log.LoggerFactory;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.log.messageid.LogMessageProvider;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.log.messageid.MessageProviderFactory;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.security.AdminTokenAction;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @author dennis
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private static final String LOG_MSG_XML = "Entitlement";
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private static final String LOG_NAME = "entitlement";
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest public static void log(LogLevel type, Level level, Message message, String[] messageData, Subject logFor) {
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest log(type, level, message.name(), messageData, logFor);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Logger logger = (type.equals(LogLevel.ERROR)) ? LoggerFactory.getLogger(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster LOG_NAME + ".error") : LoggerFactory.getLogger(LOG_NAME + ".access");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster MessageProviderFactory.getProvider(LOG_MSG_XML);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster LogRecord logRec = msgProvider.createLogRecord(msgid,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Logger.getLogger(OpenSSOLogger.class.getName()).
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private static ELogRecord getERecord(LogRecord rec) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster SSOToken adminSSOToken = (SSOToken) AccessController.doPrivileged(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ELogRecord eLogRec = new ELogRecord(rec.getLevel(), rec.getMessage(),