APISonar


org.apache.camel.spi.CamelLogger.log

> org > apache > camel > spi > CamelLogger > log
org APIs apache APIs camel APIs spi APIs CamelLogger APIs log APIs

Example 1
private final CamelLogger logger;

    protected void doLogVerbose(String message) {
        lastVerboseLogActivity = message;
        lastVerboseLogActivityTimestamp = System.currentTimeMillis();
        if (endpoint.isTransferLoggingVerbose()) {
            logger.log(message, endpoint.getTransferLoggingLevel());
        }
    }
Example 2
private CamelLogger logger = new CamelLogger(LOG, loggingLevel);

    private void log(String method, Object target, Object... args) {
        Object obj = "null";
        if (args != null && args.length > 0) {
            obj = Arrays.asList(args);
        }
        if (target == null) {
            logger.log("Invoked: " + invoked.get() + " times (overall) [Method: " + method + "]");
        } else if (args == null) {
            logger.log("Invoked: " + invoked.get() + " times (overall) [Method: " + method + ", Target: " + target + "]");
        } else {
            logger.log("Invoked: " + invoked.get() + " times (overall) [Method: " + method + ", Target: " + target + ", Arguments: " + obj + "]");
        }
    }
Example 3
private final CamelLogger logger = new CamelLogger(log, loggingLevel);

    public void enableDebugger() {
        logger.log("Enabling debugger");
        try {
            ServiceHelper.startService(debugger);
            enabled.set(true);
        } catch (Exception e) {
            throw RuntimeCamelException.wrapRuntimeCamelException(e);
        }
    }
Example 4
private final CamelLogger logger;

    public void handleException(String message, Exchange exchange, Throwable exception) {
        try {
            String msg = CamelExchangeException.createExceptionMessage(message, exchange, exception);
            boolean closed = ObjectHelper.getException(ClosedChannelException.class, exception) != null;
            if (closed) {
                logger.log(msg, exception, closedLoggingLevel);
            } else {
                logger.log(msg, exception);
            }
        } catch (Throwable e) {
            // the logging exception handler must not cause new exceptions to occur
        }
    }
Example 5
private final CamelLogger logger = new CamelLogger(log, loggingLevel);

    public void resetDebugCounter() {
        logger.log("Reset debug counter");
        debugCounter.set(0);
    }
Example 6
private final CamelLogger logger = new CamelLogger(log, loggingLevel);

    public String dumpTracedMessagesAsXml(String nodeId) {
        logger.log("Dump trace message from breakpoint " + nodeId);
        BacklogTracerEventMessage msg = suspendedBreakpointMessages.get(nodeId);
        if (msg != null) {
            return msg.toXml(0);
        } else {
            return null;
        }
    }
Example 7
protected Subject authenticate(SecurityAuthenticator authenticator, LoggingLevel deniedLoggingLevel, HttpPrincipal principal) {
        try {
            return authenticator.login(principal);
        } catch (LoginException e) {
            CamelLogger logger = new CamelLogger(LOG, deniedLoggingLevel);
            logger.log("Cannot login " + principal.getName() + " due " + e.getMessage(), e);
        }
        return null;
    }
Example 8
private final CamelLogger logger = new CamelLogger(log, loggingLevel);

    public void resumeAll() {
        logger.log("Resume all");
        // stop single stepping
        singleStepExchangeId = null;

        for (String node : getSuspendedBreakpointNodeIds()) {
            // remember to remove the dumped message as its no longer in need
            suspendedBreakpointMessages.remove(node);
            SuspendedExchange se = suspendedBreakpoints.remove(node);
            if (se != null) {
                se.getLatch().countDown();
            }
        }
    }
Example 9
private CamelLogger logger;

    public void process(Exchange exchange, Throwable exception) {
        if (logger.shouldLog()) {
            String output = formatter.format(exchange);
            if (maskingFormatter != null) {
                output = maskingFormatter.format(output);
            }
            output = fireListeners(exchange, output);
            logger.log(output, exception);
        }
    }
Example 10
private CamelLogger logger;

    public void process(Exchange exchange) throws Exception {
        if (startTime == 0) {
            startTime = System.currentTimeMillis();
        }
        int receivedCount = receivedCounter.incrementAndGet();

        //only process if groupSize is set...otherwise we're in groupInterval mode
        if (groupSize != null) {
            if (receivedCount % groupSize == 0) {
                lastLogMessage = createLogMessage(exchange, receivedCount);
                logger.log(lastLogMessage);
            }
        }
    }
Example 11
private final CamelLogger logger = new CamelLogger(log, loggingLevel);

    public void addBreakpoint(String nodeId) {
        NodeBreakpoint breakpoint = breakpoints.get(nodeId);
        if (breakpoint == null) {
            logger.log("Adding breakpoint " + nodeId);
            breakpoint = new NodeBreakpoint(nodeId, null);
            breakpoints.put(nodeId, breakpoint);
            debugger.addBreakpoint(breakpoint, breakpoint);
        } else {
            breakpoint.setCondition(null);
        }
    }
Example 12
private final CamelLogger logger = new CamelLogger(log, loggingLevel);

    public void setMessageHeaderOnBreakpoint(String nodeId, String headerName, Object value, Class<?> type) throws NoTypeConversionAvailableException {
        SuspendedExchange se = suspendedBreakpoints.get(nodeId);
        if (se != null) {
            logger.log("Breakpoint at node " + nodeId + " is updating message header on exchangeId: " + se.getExchange().getExchangeId() + " with header: " + headerName + " and value: " + value);
            if (type != null) {
                Object convertedValue = se.getExchange().getContext().getTypeConverter().mandatoryConvertTo(type, se.getExchange(), value);
                se.getExchange().getMessage().setHeader(headerName, convertedValue);
            } else {
                se.getExchange().getMessage().setHeader(headerName, value);
            }
        }
    }