Search in sources :

Example 66 with JSONBuffer

use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.

the class JSONLDAPConnectionLogger method logDisconnect.

/**
 * {@inheritDoc}
 */
@Override()
public void logDisconnect(@NotNull final LDAPConnectionInfo connectionInfo, @NotNull final String host, final int port, @NotNull final DisconnectType disconnectType, @Nullable final String disconnectMessage, @Nullable final Throwable disconnectCause) {
    if (logDisconnects) {
        final JSONBuffer buffer = startLogMessage("disconnect", null, connectionInfo, -1);
        buffer.appendString("hostname", host);
        buffer.appendNumber("port", port);
        buffer.appendString("disconnect-type", disconnectType.name());
        if (disconnectMessage != null) {
            buffer.appendString("disconnect-message", disconnectMessage);
        }
        if (disconnectCause != null) {
            appendException(buffer, "disconnect-cause", disconnectCause);
        }
        logMessage(buffer, flushAfterDisconnectMessages);
    }
}
Also used : JSONBuffer(com.unboundid.util.json.JSONBuffer)

Example 67 with JSONBuffer

use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.

the class JSONLDAPConnectionLogger method logAbandonRequest.

/**
 * {@inheritDoc}
 */
@Override()
public void logAbandonRequest(@NotNull final LDAPConnectionInfo connectionInfo, final int messageID, final int messageIDToAbandon, @NotNull final List<Control> requestControls) {
    if (logRequests && operationTypes.contains(OperationType.ABANDON)) {
        final JSONBuffer buffer = startLogMessage("request", OperationType.ABANDON, connectionInfo, messageID);
        buffer.appendNumber("message-id-to-abandon", messageIDToAbandon);
        appendControls(buffer, "control-oids", requestControls);
        logMessage(buffer, flushAfterRequestMessages);
    }
}
Also used : JSONBuffer(com.unboundid.util.json.JSONBuffer)

Example 68 with JSONBuffer

use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.

the class JSONLDAPConnectionLogger method logConnect.

/**
 * {@inheritDoc}
 */
@Override()
public void logConnect(@NotNull final LDAPConnectionInfo connectionInfo, @NotNull final String host, @NotNull final InetAddress inetAddress, final int port) {
    if (logConnects) {
        final JSONBuffer buffer = startLogMessage("connect", null, connectionInfo, -1);
        buffer.appendString("hostname", host);
        buffer.appendString("ip-address", inetAddress.getHostAddress());
        buffer.appendNumber("port", port);
        logMessage(buffer, flushAfterConnectMessages);
    }
}
Also used : JSONBuffer(com.unboundid.util.json.JSONBuffer)

Example 69 with JSONBuffer

use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.

the class JSONLDAPConnectionLogger method logAddRequest.

/**
 * {@inheritDoc}
 */
@Override()
public void logAddRequest(@NotNull final LDAPConnectionInfo connectionInfo, final int messageID, @NotNull final ReadOnlyAddRequest addRequest) {
    if (logRequests && operationTypes.contains(OperationType.ADD)) {
        final JSONBuffer buffer = startLogMessage("request", OperationType.ADD, connectionInfo, messageID);
        appendDN(buffer, "dn", addRequest.getDN());
        if (includeAddAttributeNames) {
            appendAttributes(buffer, "attributes", addRequest.getAttributes(), includeAddAttributeValues);
        }
        appendControls(buffer, "control-oids", addRequest.getControls());
        logMessage(buffer, flushAfterRequestMessages);
    }
}
Also used : JSONBuffer(com.unboundid.util.json.JSONBuffer)

Example 70 with JSONBuffer

use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.

the class JSONLDAPConnectionLogger method logIntermediateResponse.

/**
 * {@inheritDoc}
 */
@Override()
public void logIntermediateResponse(@NotNull final LDAPConnectionInfo connectionInfo, final int messageID, @NotNull final IntermediateResponse intermediateResponse) {
    if (logIntermediateResponses) {
        final JSONBuffer buffer = startLogMessage("intermediate-response", null, connectionInfo, messageID);
        final String oid = intermediateResponse.getOID();
        if (oid != null) {
            buffer.appendString("oid", oid);
        }
        buffer.appendBoolean("has-value", (intermediateResponse.getValue() != null));
        appendControls(buffer, "control-oids", intermediateResponse.getControls());
        logMessage(buffer, flushAfterRequestMessages);
    }
}
Also used : JSONBuffer(com.unboundid.util.json.JSONBuffer)

Aggregations

JSONBuffer (com.unboundid.util.json.JSONBuffer)73 Test (org.testng.annotations.Test)20 NotNull (com.unboundid.util.NotNull)16 LogRecord (java.util.logging.LogRecord)12 LDAPMessage (com.unboundid.ldap.protocol.LDAPMessage)8 Date (java.util.Date)5 LDAPException (com.unboundid.ldap.sdk.LDAPException)3 LDAPRuntimeException (com.unboundid.ldap.sdk.LDAPRuntimeException)3 JSONException (com.unboundid.util.json.JSONException)3 DN (com.unboundid.ldap.sdk.DN)2 RDN (com.unboundid.ldap.sdk.RDN)2 JSONField (com.unboundid.util.json.JSONField)2 JSONObject (com.unboundid.util.json.JSONObject)2 JSONString (com.unboundid.util.json.JSONString)2 AddResponseProtocolOp (com.unboundid.ldap.protocol.AddResponseProtocolOp)1 BindResponseProtocolOp (com.unboundid.ldap.protocol.BindResponseProtocolOp)1 CompareResponseProtocolOp (com.unboundid.ldap.protocol.CompareResponseProtocolOp)1 DeleteResponseProtocolOp (com.unboundid.ldap.protocol.DeleteResponseProtocolOp)1 ExtendedResponseProtocolOp (com.unboundid.ldap.protocol.ExtendedResponseProtocolOp)1 ModifyDNResponseProtocolOp (com.unboundid.ldap.protocol.ModifyDNResponseProtocolOp)1