Example usage for org.apache.commons.logging Log error

List of usage examples for org.apache.commons.logging Log error

Introduction

In this page you can find the example usage for org.apache.commons.logging Log error.

Prototype

void error(Object message);

Source Link

Document

Logs a message with error log level.

Usage

From source file:org.wso2.carbon.apimgt.rest.api.util.utils.RestApiUtil.java

/**
 * Logs the error, builds a ConflictException with specified details and throws it
 *
 * @param description description of the error
 * @param log Log instance//  w w w. j  a va 2 s.c  o  m
 * @throws ConflictException
 */
public static void handleConflict(String description, Log log) throws ConflictException {
    ConflictException conflictException = buildConflictException(
            RestApiConstants.STATUS_CONFLICT_MESSAGE_DEFAULT, description);
    log.error(description);
    throw conflictException;
}

From source file:org.wso2.carbon.apimgt.rest.api.util.utils.RestApiUtil.java

/**
 * Logs the error, builds a MethodNotAllowedException with specified details and throws it
 * //ww  w. jav a  2s  .c  o m
 * @param method http method
 * @param resource requested resource
 * @param log Log instance
 * @throws MethodNotAllowedException
 */
public static void handleMethodNotAllowedError(String method, String resource, Log log)
        throws MethodNotAllowedException {
    MethodNotAllowedException methodNotAllowedException = buildMethodNotAllowedException(method, resource);
    log.error(methodNotAllowedException.getMessage());
    throw methodNotAllowedException;
}

From source file:org.wso2.carbon.apimgt.rest.api.util.utils.RestApiUtil.java

/**
 * Logs the error, builds a internalServerErrorException with specified details and throws it
 *
 * @param msg error message/*from w  ww.j  av a2 s  . co m*/
 * @param log Log instance
 * @throws InternalServerErrorException
 */
public static void handleInternalServerError(String msg, Log log) throws InternalServerErrorException {
    InternalServerErrorException internalServerErrorException = buildInternalServerErrorException();
    log.error(msg);
    throw internalServerErrorException;
}

From source file:org.wso2.carbon.appmgt.gateway.utils.GatewayUtils.java

public static void logAndThrowException(Log log, String errorMessage, Exception e) {

    if (e == null) {
        log.error(errorMessage);
        throw new SynapseException(errorMessage);
    } else {/*from  w  ww .  j a  v a 2 s. c  om*/
        log.error(errorMessage, e);
        throw new SynapseException(errorMessage, e);
    }
}

From source file:org.wso2.carbon.appmgt.rest.api.util.utils.RestApiUtil.java

/**
 * Logs the error, builds a BadRequestException with specified details and throws it
 *
 * @param msg error message//from  w  ww  .j  ava2  s .  c om
 * @param log Log instance
 * @throws org.wso2.carbon.appmgt.rest.api.util.exception.BadRequestException
 */
public static void handleConflictException(String msg, Log log) throws ConflictException {
    ConflictException conflictException = buildConflictException(msg);
    log.error(msg);
    throw conflictException;
}

From source file:pt.webdetails.cpf.SimpleContentGenerator.java

/**
 * Get a map of all public methods with the Exposed annotation.
 * Map is not thread-safe and should be used read-only.
 * @param classe Class where to find methods
 * @param log classe's logger//from   w  w w.ja  va  2s.c o m
 * @param lowerCase if keys should be in lower case.
 * @return map of all public methods with the Exposed annotation
 */
protected static Map<String, Method> getExposedMethods(Class<?> classe, boolean lowerCase) {
    HashMap<String, Method> exposedMethods = new HashMap<String, Method>();
    Log log = LogFactory.getLog(classe);
    for (Method method : classe.getMethods()) {
        if (method.getAnnotation(Exposed.class) != null) {
            String methodKey = method.getName().toLowerCase();
            if (exposedMethods.containsKey(methodKey)) {
                log.error("Method " + method + " differs from " + exposedMethods.get(methodKey)
                        + " only in case and will override calls to it!!");
            }
            log.debug("registering " + classe.getSimpleName() + "." + method.getName());
            exposedMethods.put(methodKey, method);
        }
    }
    return exposedMethods;
}