private void logArtifact(PropertyDefinition artifact) { ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); String stringArtifact = null; try { stringArtifact = mapper.writeValueAsString(artifact); Log.info("Received PropertyDefinition:\n" + stringArtifact); } catch (JsonProcessingException e) { Log.error("Exception while logging artifact:", e); } } }
/** * Genral debug log when debug logging level is enabled. * @param message of the log message format * @param args of the objects listed in the message format */ void logDebug(String message, Object... args) { if (logger.isDebugEnabled()) { logger.debug(String.format(message, args)); } } }
public void stateChanged(CuratorFramework client, ConnectionState newState) { if (newState == ConnectionState.LOST) { log.info("ZooKeeper connection expired"); handleConnectionLoss(); } else if (newState == ConnectionState.READ_ONLY) { log.warn("ZooKeeper connection set to read only mode."); } else if (newState == ConnectionState.RECONNECTED) { log.info("ZooKeeper connection re-established"); handleReconnection(); } else if (newState == ConnectionState.SUSPENDED) { log.warn("ZooKeeper connection has been suspended."); handleConnectionSuspended(); } } };
/** * Logs a message at the lowest level: trace. * * @param logger * @param msg */ public void trace(EELFLogger logger, String msg) { if (logger.isTraceEnabled()) { MDC.put(LoggerProperties.MDC_CLASS_NAME, className); logger.trace(msg); MDC.remove(LoggerProperties.MDC_CLASS_NAME); } }
private boolean isThreadInterrupted(String details) { if (Thread.currentThread().isInterrupted()) { logger.info(String.format("[%d] SDC thread interrupted %s.", timeStamp, details)); return true; } return false; } }
/** * Starts a loop that will only end after stop() or stopNow() are called. The loop will read messages off the DMaaP * topic and perform some action on them while writing messages back to DMaaP at critical points in the execution. * Inherited from Runnable. * * @see java.lang.Runnable#run() */ @Override public void run() { LOG.error("Listener.run() has not been implemented"); }
@Override public void handleUpgradeStub(Map<String, String> params, SvcLogicContext ctx) throws APPCException { logger.debug("Entering in handleUpgradeStub : "+ params.toString()); String failureInd = params.get(FAILURE_INDICATOR_FIELD_NAME); if (null != failureInd && Boolean.valueOf(failureInd)){ throw new APPCException("Simulating exception..."); } logger.info("Simulating was successful"); } }
@Override public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { LOG.debug("Inside checkClientTrusted"); }
public VnfcDependencyModel getVnfcDependencyModel(DependencyModelIdentifier modelIdentifier,DependencyTypes dependencyType) throws InvalidDependencyModel, DependencyModelNotFound { if (logger.isTraceEnabled()) { logger.trace("Entering to getVnfcDependencyModel with DependencyModelIdentifier = "+ modelIdentifier + " , DependencyTypes = " + dependencyType); } VnfcDependencyModel dependencyModel = cache.getObject(modelIdentifier); if(dependencyModel == null){ logger.debug("Dependency model not found in cache, creating strategy for reading it"); DependencyType strategy = getStrategy(dependencyType); dependencyModel = strategy.getVnfcDependencyModel(modelIdentifier); } if (logger.isTraceEnabled()) { logger.trace("Returning getVnfcDependencyModel with dependency model = "+ dependencyModel); } return dependencyModel; }
/** * * @param msg * @param t */ public void warn(String msg, Exception t) { LOG.warn(fId + msg, t); }
private String mergeJson(String requestParamJson, String systemParamJson) throws Exception { ObjectMapper mapper = new ObjectMapper(); Map<String, String> requestParamMap = mapper.readValue(requestParamJson, HashMap.class); if(requestParamMap != null){ Map<String, String> systemParamMap = mapper.readValue(systemParamJson, HashMap.class); if(systemParamMap != null){ for (String systemParamKey : systemParamMap.keySet()) { log.trace("Megging System Key Values " + systemParamKey); requestParamMap.put( systemParamKey , systemParamMap.get(systemParamKey)); } } requestParamJson = mapper.writeValueAsString(requestParamMap); log.info("Processed Request Param " + requestParamJson); } return requestParamJson; }
@SuppressWarnings("squid:S2095") @Override public Connection getConnection() throws SQLException { Connection c = dataSource.getConnection(); logger.trace("getConnection: ({})", c.getClass().getName()); c.setAutoCommit(true); return c; }
@Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { LOG.error(String.format("A job was rejected. [%s]", r)); } }
@Override public int update(String sql, Object[] data) throws SvcLogicException { logger.debug("Query ({}) with data ({})", sql, data); return jdbcTemplate.update(sql, data); }
public VnfcDependencyModel getVnfcDependencyModel(DependencyModelIdentifier modelIdentifier) throws InvalidDependencyModelException, DependencyModelNotFound { if (logger.isTraceEnabled()) { logger.trace("Entering to getVnfcDependencyModel with DependencyModelIdentifier = "+ modelIdentifier); } String vnfModel = metadataService.getVnfModel(modelIdentifier); if(vnfModel ==null){ logger.debug("Vnf model not found from metadata service"); throw new DependencyModelNotFound("Invalid or Empty VNF Model"); } if (logger.isTraceEnabled()) { logger.trace("Building dependency model for Vnf Model : " + vnfModel); } DependencyModelParser modelParser = new DependencyModelParser(); return modelParser.generateDependencyModel(vnfModel,modelIdentifier.getVnfType()); } }
/** * Logs a message at warn level. * * @param logger * @param msg */ public void warn(EELFLogger logger, String msg) { MDC.put(LoggerProperties.MDC_CLASS_NAME, className); logger.warn(msg); MDC.remove(LoggerProperties.MDC_CLASS_NAME); }
private String mergeJson(String requestParamJson, String systemParamJson) throws IOException { ObjectMapper mapper = new ObjectMapper(); Map<String, String> requestParamMap = mapper.readValue(requestParamJson, HashMap.class); if (requestParamMap != null) { Map<String, String> systemParamMap = mapper.readValue(systemParamJson, HashMap.class); if (systemParamMap != null) { for (Entry<String, String> entry : systemParamMap.entrySet()) { log.trace("Megging System Key Values " + entry.getKey()); requestParamMap.put(entry.getKey(), entry.getValue()); } } log.info("Processed Request Param " + requestParamJson); return mapper.writeValueAsString(requestParamMap); } return requestParamJson; }
/** * Logs a message with parameters at the lowest level: trace. * * @param logger * @param msg * @param arguments */ public void trace(EELFLogger logger, String msg, Object... arguments) { if (logger.isTraceEnabled()) { MDC.put(LoggerProperties.MDC_CLASS_NAME, className); logger.trace(msg, arguments); MDC.remove(LoggerProperties.MDC_CLASS_NAME); } }