Search in sources :

Example 26 with Level

use of java.util.logging.Level in project hazelcast by hazelcast.

the class ClusterListenerSupport method connect.

private boolean connect(Set<InetSocketAddress> triedAddresses) throws Exception {
    final Collection<InetSocketAddress> socketAddresses = getSocketAddresses();
    for (InetSocketAddress inetSocketAddress : socketAddresses) {
        if (!client.getLifecycleService().isRunning()) {
            if (logger.isFinestEnabled()) {
                logger.finest("Giving up on retrying to connect to cluster since client is shutdown");
            }
            break;
        }
        Connection connection = null;
        try {
            triedAddresses.add(inetSocketAddress);
            Address address = new Address(inetSocketAddress);
            logger.info("Trying to connect to " + address + " as owner member");
            connection = connectionManager.getOrConnect(address, true);
            clientMembershipListener.listenMembershipEvents(ownerConnectionAddress);
            fireConnectionEvent(LifecycleEvent.LifecycleState.CLIENT_CONNECTED);
            return true;
        } catch (Exception e) {
            Level level = e instanceof AuthenticationException ? Level.WARNING : Level.FINEST;
            logger.log(level, "Exception during initial connection to " + inetSocketAddress, e);
            if (null != connection) {
                connection.close("Could not connect to " + inetSocketAddress + " as owner", e);
            }
        }
    }
    return false;
}
Also used : Address(com.hazelcast.nio.Address) InetSocketAddress(java.net.InetSocketAddress) AuthenticationException(com.hazelcast.client.AuthenticationException) InetSocketAddress(java.net.InetSocketAddress) Connection(com.hazelcast.nio.Connection) Level(java.util.logging.Level) AuthenticationException(com.hazelcast.client.AuthenticationException) TargetDisconnectedException(com.hazelcast.spi.exception.TargetDisconnectedException)

Example 27 with Level

use of java.util.logging.Level in project hazelcast by hazelcast.

the class ReplicaSyncResponse method logException.

private void logException(Operation op, Throwable e) {
    ILogger logger = getLogger();
    NodeEngine nodeEngine = getNodeEngine();
    Level level = nodeEngine.isRunning() ? Level.WARNING : Level.FINEST;
    if (logger.isLoggable(level)) {
        logger.log(level, "While executing " + op, e);
    }
}
Also used : NodeEngine(com.hazelcast.spi.NodeEngine) ILogger(com.hazelcast.logging.ILogger) Level(java.util.logging.Level)

Example 28 with Level

use of java.util.logging.Level in project hazelcast by hazelcast.

the class LoggingScheduledExecutor method afterExecute.

@Override
protected void afterExecute(Runnable runnable, Throwable throwable) {
    super.afterExecute(runnable, throwable);
    Level level = FINE;
    if (throwable == null && runnable instanceof ScheduledFuture && ((ScheduledFuture) runnable).isDone()) {
        try {
            ((Future) runnable).get();
        } catch (CancellationException ce) {
            throwable = ce;
        } catch (ExecutionException ee) {
            level = SEVERE;
            throwable = ee.getCause();
        } catch (InterruptedException ie) {
            throwable = ie;
            currentThread().interrupt();
        }
    }
    if (throwable != null) {
        logger.log(level, "Failed to execute " + runnable, throwable);
    }
}
Also used : CancellationException(java.util.concurrent.CancellationException) ScheduledFuture(java.util.concurrent.ScheduledFuture) Future(java.util.concurrent.Future) RunnableScheduledFuture(java.util.concurrent.RunnableScheduledFuture) Level(java.util.logging.Level) ExecutionException(java.util.concurrent.ExecutionException) ScheduledFuture(java.util.concurrent.ScheduledFuture) RunnableScheduledFuture(java.util.concurrent.RunnableScheduledFuture)

Example 29 with Level

use of java.util.logging.Level in project j2objc by google.

the class LevelTest method testParse_UndefinedNumber.

/*
	 * Test method parse, with an undefined valid number strings.
	 */
public void testParse_UndefinedNumber() {
    Level l = Level.parse("0");
    assertEquals(0, l.intValue());
    assertEquals("0", l.getName());
    assertNull(l.getResourceBundleName());
}
Also used : Level(java.util.logging.Level)

Example 30 with Level

use of java.util.logging.Level in project j2objc by google.

the class LevelTest method testParse_NegativeNumber.

public void testParse_NegativeNumber() {
    Level l = Level.parse("-4");
    assertEquals(-4, l.intValue());
    assertEquals("-4", l.getName());
    assertNull(l.getResourceBundleName());
}
Also used : Level(java.util.logging.Level)

Aggregations

Level (java.util.logging.Level)94 Test (org.junit.Test)14 Logger (java.util.logging.Logger)11 IOException (java.io.IOException)7 Handler (java.util.logging.Handler)7 LogRecord (java.util.logging.LogRecord)6 ArrayList (java.util.ArrayList)5 Properties (java.util.Properties)5 SystemConfig (com.twitter.heron.common.config.SystemConfig)4 Date (java.util.Date)4 Formatter (java.util.logging.Formatter)4 MockResponse (okhttp3.mockwebserver.MockResponse)4 AcsLogLevel (alma.acs.logging.AcsLogLevel)3 ErrorReportLoggingHandler (com.twitter.heron.common.utils.logging.ErrorReportLoggingHandler)3 Config (com.twitter.heron.spi.common.Config)3 Map (java.util.Map)3 LogConfig (alma.acs.logging.config.LogConfig)2 AcsLogLevelDefinition (alma.acs.logging.level.AcsLogLevelDefinition)2 ILogger (com.hazelcast.logging.ILogger)2 SSOException (com.iplanet.sso.SSOException)2