APISonar


com.hazelcast.logging.ILogger.log

> com > hazelcast > logging > ILogger > log
com APIs hazelcast APIs logging APIs ILogger APIs log APIs

Example 1
private final ILogger logger;

    protected void log(Level level, String taskName, String msg, Throwable t) {
        if (logger.isLoggable(level)) {
            StringBuilder log = new StringBuilder();
            log.append("[Scheduler: " + name + "][Partition: " + partitionId + "]");
            if (taskName != null) {
                log.append("[Task: " + taskName + "] ");
            }
            log.append(msg);
            logger.log(level, log.toString(), t);
        }
    }
Example 2
private final static ILogger logger = Logger.getLogger("com.hazelcast.jca");

    void log(Level logLevel, String message, Throwable t) {
    	if (logger.isLoggable(logLevel)) {
    		//Log to hazelcast loggin framework itself
	    	logger.log(logLevel, message, t);
	    	final PrintWriter logWriter = getLogWriter();
	    	//Log via the container if possible
			if (logWriter != null) {
	    		logWriter.write(message);
	    		if (t != null) {
	    			t.printStackTrace(logWriter);
	    		}
	    	}
    	}
    }
Example 3
private static final ILogger LOG = Logger.getLogger(HazelcastCacheRegionFactory.class.getName());

    public void stop() {
        LOG.log(Level.INFO, "Shutting down HazelcastCacheRegionFactory...");
        Hazelcast.shutdown();
    }
Example 4
private final ILogger logger;

    private void log(Level level, String message) {
        logger.log(level, message);
        connectionManager.ioService.getSystemLogService().logConnection(message);
    }
Example 5
private static final ILogger LOG = Logger.getLogger(HazelcastCache.class.getName());

    public HazelcastCache(final String regionName) {
        LOG.log(Level.INFO, "Creating new HazelcastCache with region name: " + regionName);
        cache = Hazelcast.getMap(regionName);
        this.regionName = regionName;
    }
Example 6
public void logError(Throwable e) {
        if (e instanceof PartitionStateVersionMismatchException) {
            ILogger logger = getLogger();
            if (logger.isFineEnabled()) {
                logger.log(Level.FINE, e.getMessage(), e);
            }
            return;
        }

        super.logError(e);
    }
Example 7
protected final ILogger logger;

    final void handleSocketException(Throwable e) {
        logger.log(Level.FINEST, Thread.currentThread().getName() + " Closing Socket. cause:  ", e);
        if (sk != null)
            sk.cancel();
        connection.close();
    }
Example 8
protected final ILogger logger;

    protected void handleSelectorException(final Exception e) {
        String msg = "Selector exception at  " + Thread.currentThread().getName();
        msg += ", cause= " + e.toString();
        logger.log(Level.FINEST, msg, e);
    }
Example 9
private Object handleUnauthenticated() {
        Connection connection = endpoint.getConnection();
        ILogger logger = clientEngine.getLogger(getClass());
        logger.log(Level.WARNING, "Received auth from " + connection
                + " with principal " + principal + " , authentication failed");
        return new AuthenticationException("Invalid credentials!");
    }
Example 10
private final ILogger logger;

    private void join() {
        if (!config.getNetworkConfig().getJoin().getMulticastConfig().isEnabled()) {
            joinWithTCP();
        } else {
            joinWithMulticast();
        }
        clusterManager.finalizeJoin();
        if (baseVariables.lsMembers.size() == 1) {
            final StringBuilder sb = new StringBuilder();
            sb.append("\n");
            sb.append(clusterManager);
            logger.log(Level.INFO, sb.toString());
        }
    }
Example 11
private final ILogger logger = Logger.getLogger(FileSystemXmlConfig.class.getName());

	public FileSystemXmlConfig(File configFile) throws FileNotFoundException {
		super();
		
		logger.log(Level.INFO, "Configuring Hazelcast from '" + configFile.getAbsolutePath() + "'.");
		InputStream in = new FileInputStream(configFile);
		new XmlConfigBuilder(in).build(this);
	}
Example 12
private final ILogger logger;

    void setAsMaster() {
        logger.log(Level.FINE, "This node is being set as the isMaster");
        masterAddress = address;
        logger.log(Level.FINEST, "adding member myself");
        clusterManager.addMember(address, getLocalNodeType()); // add
        // myself
        clusterImpl.setMembers(baseVariables.lsMembers);
        unlock();
    }
Example 13
private final ILogger logger;

    private void connectAndSendJoinRequest(Address masterAddress) throws Exception {
        if (masterAddress == null || masterAddress.equals(address)) {
            throw new IllegalArgumentException();
        }
        Connection conn = connectionManager.getOrConnect(masterAddress);
        logger.log(Level.FINEST, "Master connection " + conn);
        if (conn != null) {
            clusterManager.sendJoinRequest(masterAddress);
        }
    }
Example 14
private final ILogger logger = Logger.getLogger(getClass().getName());

    public synchronized void destroyConnection(Connection connection) {
        if (currentConnection != null && currentConnection.getVersion() == connection.getVersion()) {
            logger.log(Level.WARNING, "Connection to " + currentConnection + " is lost");
            currentConnection = null;
        }
    }
Example 15
private static final ILogger LOGGER = Logger.getLogger(AwsAddressTranslator.class);

    public void refresh() {
        try {
            privateToPublic = awsClient.getAddresses();
        } catch (Exception e) {
            LOGGER.log(Level.WARNING, "Aws addresses are failed to load : " + e.getMessage());
        }
    }
Example 16
private final ILogger logger = Logger.getLogger(UrlXmlConfig.class.getName());

	public UrlXmlConfig(URL url) throws IOException {
		super();
		
		logger.log(Level.INFO, "Configuring Hazelcast from '" + url.toString() + "'.");
		InputStream in = url.openStream();
		new XmlConfigBuilder(in).build(this);
	}
Example 17
private final ILogger logger = Logger.getLogger(XmlConfigBuilder.class.getName());

    private int getIntegerValue(final String parameterName, final String value,
                                final int defaultValue) {
        try {
            return Integer.parseInt(value);
        } catch (final Exception e) {
            logger.log(Level.INFO, parameterName + " parameter value, [" + value
                    + "], is not a proper integer. Default value, [" + defaultValue
                    + "], will be used!");
            e.printStackTrace();
            return defaultValue;
        }
    }
Example 18
public static void log(Throwable e, final ILogger logger) {
        if (e instanceof RetryableException) {
            Level level = Level.INFO;
            if (e instanceof CallerNotMemberException
                    || e instanceof WrongTargetException
                    || e instanceof TargetNotMemberException) {
                level = Level.FINEST;
            }
            logger.log(level, e.toString());
        } else {
            logger.warning(e);
        }
    }
Example 19
public void logError(Throwable e) {
        final ILogger logger = getLogger();
        if (e instanceof RetryableException) {
            logger.warning("Op: " + op + ", " + e.getClass().getName() + ": " + e.getMessage());
        } else if (e instanceof OutOfMemoryError) {
            try {
                logger.log(Level.SEVERE, e.getMessage(), e);
            } catch (Throwable ignored) {
                ignore(ignored);
            }
        } else {
            logger.severe("Op: " + op + ", Error: " + e.getMessage(), e);
        }
    }
Example 20
private static final ILogger LOGGER = Logger.getLogger(OperatingSystemMetricSet.class);

    private static Method getMethod(Object source, String methodName, String name) {
        try {
            Method method = source.getClass().getMethod(methodName);
            method.setAccessible(true);
            return method;
        } catch (Exception e) {
            if (LOGGER.isFinestEnabled()) {
                LOGGER.log(Level.FINEST,
                        "Unable to register OperatingSystemMXBean method " + methodName + " used for probe " + name, e);
            }
            return null;
        }
    }
Example 21
private final ILogger logger = Logger.getLogger(ClasspathXmlConfig.class.getName());

	public ClasspathXmlConfig(ClassLoader classLoader, String resource) {
		super();
		
		logger.log(Level.INFO, "Configuring Hazelcast from '" + resource + "'.");
		InputStream in = classLoader.getResourceAsStream(resource);
		if(in == null) {
			throw new NullPointerException("Specified resource '" + resource + "' could not be found!");
		}
		new XmlConfigBuilder(in).build(this);
	}
Example 22
protected final ILogger logger;

    private void logProcessingFailure(Throwable throwable) {
        Level level = nodeEngine.isRunning() ? Level.SEVERE : Level.FINEST;
        if (logger.isLoggable(level)) {
            if (parameters == null) {
                logger.log(level, throwable.getMessage(), throwable);
            } else {
                logger.log(level, "While executing request: " + parameters + " -> " + throwable.getMessage(), throwable);
            }
        }
    }
Example 23
private static final ILogger LOGGER = Logger.getLogger(DiscoveryAddressProvider.class);

    public Collection<InetSocketAddress> loadAddresses() {
        Collection<InetSocketAddress> possibleMembers = new ArrayList<InetSocketAddress>();
        for (DiscoveryNode discoveryNode : discoveryService.discoverNodes()) {
            Address discoveredAddress = discoveryNode.getPrivateAddress();
            try {
                possibleMembers.add(discoveredAddress.getInetSocketAddress());
            } catch (UnknownHostException e) {
                LOGGER.log(Level.WARNING, "Unresolvable host exception: " + discoveredAddress, e);
            }
        }
        return possibleMembers;
    }
Example 24
final ILogger logger = com.hazelcast.logging.Logger.getLogger(this.getClass().getName());

    public Call createCall(Packet request) {
        final long id = newCallId();
        return new Call(id, request) {
            @Override
            public void onDisconnect(Member member) {
                logger.log(Level.FINE, "Re enqueue " + this);
                if (!client.getOutRunnable().queue.contains(this)) {
                    client.getOutRunnable().enQueue(this);
                }
            }
        };
    }
Example 25
private final ILogger logger = Logger.getLogger(InMemoryXmlConfig.class.getName());

	public InMemoryXmlConfig(String xml) {
		super();
		logger.log(Level.INFO, "Configuring Hazelcast from 'in-memory xml'.");
		
		if(xml == null || "".equals(xml.trim())) {
			throw new IllegalArgumentException("XML configuration is null or empty! Please use a well-structured xml.");
		}
		
		InputStream in = new ByteArrayInputStream(xml.getBytes());
		new XmlConfigBuilder(in).build(this);
	}