8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2006 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: RemoteFormatter.java,v 1.9 2009/08/19 21:12:50 ww203982 Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The formatter which prepares the xml string to be sent to a remote log
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * service. This xml string conforms to the logDTD.xml file which is given
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <?XML version="1.0">
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!--This DTD is used by Logging operation-->
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!DOCTYPE logging [
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!ELEMENT logRecWrite (log, logRecord*)>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!ELEMENT log>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!ATTLIST log
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * logName CDATA #REQUIRED
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * sid CDATA #REQUIRED
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!ELEMENT logRecord (level ,msg ,logType? , logInfo? ,parameters?)>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!ELEMENT level (#PCDATA)>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!ELEMENT recMsg (#PCDATA)>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!ELEMENT logType (#PCDATA)>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!ELEMENT logInfoMap (logInfo*)>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!ELEMENT logInfo (key ,infoValue)>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!ELEMENT key (#PCDATA)>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!ELEMENT infoValue (#PCDATA)>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!ELEMENT parameters (parameter*)>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!ELEMENT parameter (index ,paramValue)>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!ELEMENT index (#PCDATA)>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <!ELEMENT paramValue (#PCDATA)>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpublic class RemoteFormatter extends Formatter {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The method which does the actual formatting of the LogRecord.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param logRecord The logRecord to be formatted
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return The string formed by formatting the logRecord
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public String format(java.util.logging.LogRecord logRecord) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster logInfo = ((com.sun.identity.log.ILogRecord) logRecord)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Debug.warning("RemoteFormatter : returning null" +
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster " because logRecord doesn't have loggedBySid");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Object [] parameters = logRecord.getParameters();
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster msg = com.sun.identity.shared.encode.Base64.encode(msg.getBytes());
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster infoValue = com.sun.identity.shared.encode.Base64.encode(
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster if ((parameters != null) && (parameters.length > 0)) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Debug.message("RemoteFormatter: XML Req string = " + xml);