@Override public void success(String type, Tuple<Long, Settings> settings) { if(latch.getCount() <= 0) { log.error("Latch already counted down (for {} of {}) (index={})", type, Arrays.toString(events), searchguardIndex); } rs.put(type, settings); latch.countDown(); if(log.isDebugEnabled()) { log.debug("Received config for {} (of {}) with current latch value={}", type, Arrays.toString(events), latch.getCount()); } }
private List<String> walkFileTree(List<String> files, Path path) { if (Files.isRegularFile(path)) { files.add(path.toString()); } else if (Files.isDirectory(path)) try { Files.walkFileTree(path, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { files.add(file.toString()); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException e) { logger.error("[Ext Loading] listing files", e); return FileVisitResult.CONTINUE; } }); } catch (IOException e) { logger.error("[Ext Loading] listing files", e); } else { logger.warn("[Ext Loading] file not found: " + path); } return files; }
public boolean deleteUser(UserKey userKey) { int removed = 0; try (Connection connection = ds.getConnection(); PreparedStatement ps = connection.prepareStatement(deleteUser)) { ps.setString(1, userKey.email); ps.setString(2, userKey.appName); removed = ps.executeUpdate(); connection.commit(); } catch (Exception e) { log.error("Error removing user {} from DB.", userKey, e); } return removed > 0; } }
@Override public void close(boolean keepAlive) { if (logger.isDebugEnabled()) { logger.debug("Shutting down connection manager with keepAlive {}", keepAlive); if (!this.loadConditioningProcessor.awaitTermination(PoolImpl.SHUTDOWN_TIMEOUT, TimeUnit.MILLISECONDS)) { logger.warn("Timeout waiting for load conditioning tasks to complete"); logger.error("Error stopping loadConditioningProcessor", e); } catch (InterruptedException e) { logger.error( "Interrupted stopping loadConditioningProcessor", e);
public static void main(final String[] args) { try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), "target/test-classes/log4j2-console-highlight-logback.xml")) { LOG.fatal("Fatal message."); LOG.error("Error message."); LOG.warn("Warning message."); LOG.info("Information message."); LOG.debug("Debug message."); LOG.trace("Trace message."); LOG.error("Error message.", new IOException("test")); } }
statement = connection.prepareStatement(sequenceSQL); statement.setString(1, sequenceName); if (schemaFilter) { statement.setString(2, schema); log.error("Error attempting to determine if sequence " + sequenceName + " exists", e); } finally { try { statement.close();
public FullHttpResponse invoke(Object[] params) { try { mark(); return (FullHttpResponse) classMethod.invoke(handler, params); } catch (Exception e) { Throwable cause = e.getCause(); if (cause == null) { log.error("Error invoking handler. Reason : {}.", e.getMessage()); log.debug(e); } else { log.error("Error invoking handler. Reason : {}.", cause.getMessage()); log.debug(cause); } return Response.serverError(e.getMessage()); } }
public String selectHostByToken(String token) { try (Connection connection = ds.getConnection(); PreparedStatement statement = connection.prepareStatement(selectHostByToken)) { statement.setString(1, token); try (ResultSet rs = statement.executeQuery()) { connection.commit(); if (rs.next()) { return rs.getString("host"); } } } catch (Exception e) { log.error("Error getting token host. Reason : {}", e.getMessage()); } return null; }
@Override public void onDisconnect(InternalDistributedSystem sys) { if (logger.isDebugEnabled()) { this.logger.debug("Calling AdminDistributedSystemJmxImpl#onDisconnect"); this.mbeanName, notificationSequenceNumber.addAndGet(1), null)); } catch (MBeanException e) { logger.warn(e.getMessage(), e); logger.warn(e.getMessage(), e); throw e; } catch (VirtualMachineError err) { logger.error(e.getMessage(), e); throw e; if (logger.isDebugEnabled()) { this.logger.debug("Completed AdminDistributedSystemJmxImpl#onDisconnect");
public static void main(final String[] args) { System.setProperty("log4j.skipJansi", "false"); // LOG4J2-2087: explicitly enable try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), "target/test-classes/log4j2-console-highlight.xml")) { LOG.fatal("Fatal message."); LOG.error("Error message."); LOG.warn("Warning message."); LOG.info("Information message."); LOG.debug("Debug message."); LOG.trace("Trace message."); LOG.error("Error message.", new IOException("test")); } }
@Override public void success(String id, Tuple<Long, Settings> settings) { if(latch.getCount() <= 0) { log.error("Latch already counted down (for {} of {}) (index={})", id, Arrays.toString(events), searchguardIndex); } rs.put(id, settings); latch.countDown(); if(log.isDebugEnabled()) { log.debug("Received config for {} (of {}) with current latch value={}", id, Arrays.toString(events), latch.getCount()); } }
private static void logError(String errorMessage, String email) { if (errorMessage != null) { if (errorMessage.contains("Status is a duplicate")) { log.warn("Duplicate twit status for user {}.", email); } else if (errorMessage.contains("Authentication credentials")) { log.warn("Tweet authentication failure for {}.", email); } else if (errorMessage.contains("The request is understood, but it has been refused.")) { log.warn("User twit account is banned by twitter. {}.", email); } else { log.error("Error sending twit for user {}. Reason : {}", email, errorMessage); } } }
protected void processEventorAndWebhook(User user, DashBoard dash, int deviceId, Session session, short pin, PinType pinType, String value, long now) { try { eventorProcessor.process(user, session, dash, deviceId, pin, pinType, value, now); webhookProcessor.process(session, dash, deviceId, pin, pinType, value, now); } catch (QuotaLimitException qle) { log.debug("User {} reached notification limit for eventor/webhook.", user.name); } catch (IllegalArgumentException iae) { log.debug("Error processing webhook for {}. Reason : {}", user.email, iae.getMessage()); } catch (Exception e) { log.error("Error processing eventor/webhook.", e); } }
public boolean insertTokenHost(String token, String host, String email, int dashId, int deviceId) { try (Connection connection = ds.getConnection(); PreparedStatement ps = connection.prepareStatement(insertTokenHostProject)) { ps.setString(1, token); ps.setString(2, host); ps.setString(3, email); ps.setInt(4, dashId); ps.setInt(5, deviceId); ps.executeUpdate(); connection.commit(); return true; } catch (Exception e) { log.error("Error insert token host. Reason : {}", e.getMessage()); } return false; }
@Override public void disconnect() { try { super.disconnect(); // Save existing StatAlert Definitions saveAlertDefinitionsAsSerializedObjects(); /* Remove Cache Listener to listen to Cache & Region create/destroy events */ if (logger.isDebugEnabled()) { logger.debug("Removing CacheAndRegionListener .... "); } removeCacheListener(cacheRegionListener); } catch (RuntimeException e) { logger.warn(e.getMessage(), e); throw e; } catch (VirtualMachineError err) { SystemFailure.initiateFailure(err); // If this ever returns, re-throw the error. We're poisoned // now, so don't let this thread continue. throw err; } catch (Error e) { // Whenever you catch Error or Throwable, you must also // catch VirtualMachineError (see above). However, there is // _still_ a possibility that you are dealing with a cascading // error condition, so you also need to check to see if the JVM // is still usable: SystemFailure.checkFailure(); logger.error(e.getMessage(), e); throw e; } }
public static void main(final String[] args) { System.setProperty("log4j.skipJansi", "false"); // LOG4J2-2087: explicitly enable try (final LoggerContext ctx = Configurator.initialize(ConsoleAppenderAnsiMessagesMain.class.getName(), "target/test-classes/log4j2-console.xml")) { LOG.fatal("\u001b[1;35mFatal message.\u001b[0m"); LOG.error("\u001b[1;31mError message.\u001b[0m"); LOG.warn("\u001b[0;33mWarning message.\u001b[0m"); LOG.info("\u001b[0;32mInformation message.\u001b[0m"); LOG.debug("\u001b[0;36mDebug message.\u001b[0m"); LOG.trace("\u001b[0;30mTrace message.\u001b[0m"); LOG.error("\u001b[1;31mError message.\u001b[0m", new IOException("test")); } }
private Function newFunction(final Class<Function> clazz, final boolean errorOnNoSuchMethod) { try { final Constructor<Function> constructor = clazz.getConstructor(); return constructor.newInstance(); } catch (NoSuchMethodException nsmex) { if (errorOnNoSuchMethod) { logger.error("Zero-arg constructor is required, but not found for class: {}", clazz.getName(), nsmex); } else { if (logger.isDebugEnabled()) { logger.debug( "Not registering function because it doesn't have a zero-arg constructor: {}", clazz.getName()); } } } catch (Exception ex) { logger.error("Error when attempting constructor for function for class: {}", clazz.getName(), ex); } return null; }
private void addZipEntryAndWrite(ZipOutputStream zipStream, String onePinFileName, byte[] onePinDataCsv) throws IOException { ZipEntry zipEntry = new ZipEntry(onePinFileName); try { zipStream.putNextEntry(zipEntry); zipStream.write(onePinDataCsv); zipStream.closeEntry(); } catch (ZipException zipException) { String message = zipException.getMessage(); if (message != null && message.contains("duplicate")) { log.warn("Duplicate zip entry {}. Wrong report configuration.", onePinFileName); } else { log.error("Error compressing report file.", message); throw zipException; } } catch (IOException e) { log.error("Error compressing report file.", e.getMessage()); throw e; } }
public static DashBoard deepCopy(DashBoard dash) { if (dash == null) { return null; } try { TokenBuffer tb = new TokenBuffer(JsonParser.MAPPER, false); JsonParser.MAPPER.writeValue(tb, dash); return JsonParser.MAPPER.readValue(tb.asParser(), DashBoard.class); } catch (Exception e) { log.error("Error during deep copy of dashboard. Reason : {}", e.getMessage()); log.debug(e); } return null; }
public String getUserServerIp(String email, String appName) { String ip = null; try (Connection connection = ds.getConnection(); PreparedStatement statement = connection.prepareStatement(selectIpForUser)) { statement.setString(1, email); statement.setString(2, appName); try (ResultSet rs = statement.executeQuery()) { while (rs.next()) { ip = rs.getString("ip"); } connection.commit(); } } catch (Exception e) { log.error("Error getting user server ip. {}-{}. Reason : {}", email, appName, e.getMessage()); } return ip; }