com.esotericsoftware.minlog.Log Java Examples
The following examples show how to use
com.esotericsoftware.minlog.Log.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MinlogForwarder.java From Flink-CEPplus with Apache License 2.0 | 7 votes |
@Override public void log (int level, String category, String message, Throwable ex) { final String logString = "[KRYO " + category + "] " + message; switch (level) { case Log.LEVEL_ERROR: log.error(logString, ex); break; case Log.LEVEL_WARN: log.warn(logString, ex); break; case Log.LEVEL_INFO: log.info(logString, ex); break; case Log.LEVEL_DEBUG: log.debug(logString, ex); break; case Log.LEVEL_TRACE: log.trace(logString, ex); break; } }
Example #2
Source File: BlocksPerformanceWriter.java From JedAIToolkit with Apache License 2.0 | 6 votes |
private Connection getPostgreSQLconnection(String dbURL) throws IOException { try { final Properties props = new Properties(); if (!(dbuser == null)) { props.setProperty("user", dbuser); } if (!(dbpassword == null)) { props.setProperty("password", dbpassword); } if (ssl) { props.setProperty("ssl", "true"); } return DriverManager.getConnection("jdbc:" + dbURL, props); } catch (Exception ex) { Log.error("Error with database connection!", ex); return null; } }
Example #3
Source File: AbstractEntityClustering.java From JedAIToolkit with Apache License 2.0 | 6 votes |
protected void initializeData(SimilarityPairs simPairs) { Log.info("Applying " + getMethodName() + " with the following configuration : " + getMethodConfiguration()); // simPairs.normalizeSimilarities(); isCleanCleanER = simPairs.isCleanCleanER(); int maxEntity1 = getMaxEntityId(simPairs.getEntityIds1()); int maxEntity2 = getMaxEntityId(simPairs.getEntityIds2()); if (simPairs.isCleanCleanER()) { datasetLimit = maxEntity1 + 1; noOfEntities = maxEntity1 + maxEntity2 + 2; } else { datasetLimit = 0; noOfEntities = Math.max(maxEntity1, maxEntity2) + 1; } similarityGraph = new UndirectedGraph(noOfEntities); }
Example #4
Source File: FreddyModuleBase.java From freddy with GNU Affero General Public License v3.0 | 6 votes |
/******************* * Handle Collaborator server interactions for this module. * * @param interaction The Collaborator interaction object. * @return True if the interaction was generated and handled by this module. ******************/ public boolean handleCollaboratorInteraction(IBurpCollaboratorInteraction interaction) { String interactionId = interaction.getProperty("interaction_id"); boolean result = false; Iterator<CollaboratorRecord> iterator = _collabRecords.iterator(); while (iterator.hasNext()) { CollaboratorRecord record = iterator.next(); if (record.getCollaboratorId().equals(interactionId)) { try { _callbacks.addScanIssue(createCollaboratorIssue(record, interaction)); } catch (Exception ex) { Log.debug("FreddyModuleBase[" + _targetName + "]::handleCollaboratorInteraction() exception: " + ex.getMessage()); } iterator.remove(); result = true; } } return result; }
Example #5
Source File: MailService.java From pacbot with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") public String processTemplate(String templateUrl, Map<String, Object> model) { try { if(templateUrl != null) { String mailBody = mailContentBuilderService.getRemoteMailContent(templateUrl); Configuration cfg = new Configuration(); cfg.setObjectWrapper(new DefaultObjectWrapper()); Template t = new Template(UUID.randomUUID().toString(), new StringReader(mailBody), cfg); Writer out = new StringWriter(); t.process(model, out); return out.toString(); } } catch (Exception exception) { Log.error(exception.getMessage()); } return null; }
Example #6
Source File: MinlogForwarder.java From flink with Apache License 2.0 | 6 votes |
@Override public void log (int level, String category, String message, Throwable ex) { final String logString = "[KRYO " + category + "] " + message; switch (level) { case Log.LEVEL_ERROR: log.error(logString, ex); break; case Log.LEVEL_WARN: log.warn(logString, ex); break; case Log.LEVEL_INFO: log.info(logString, ex); break; case Log.LEVEL_DEBUG: log.debug(logString, ex); break; case Log.LEVEL_TRACE: log.trace(logString, ex); break; } }
Example #7
Source File: GtRdfCsvReader.java From JedAIToolkit with Apache License 2.0 | 6 votes |
protected void getUnilateralConnectedComponents(List<Set<Integer>> connectedComponents) { for (Set<Integer> cluster : connectedComponents) { if (cluster.size() < 2) { Log.warn("Connected component with a single element! " + cluster.toString()); continue; } // add a new pair of IdDuplicates for every pair of entities in the cluster int clusterSize = cluster.size(); Integer[] clusterEntities = cluster.toArray(new Integer[clusterSize]); for (int i = 0; i < clusterSize; i++) { for (int j = i + 1; j < clusterSize; j++) { idDuplicates.add(new IdDuplicates(clusterEntities[i], clusterEntities[j])); } } } }
Example #8
Source File: WeightedEdgePruning.java From JedAIToolkit with Apache License 2.0 | 6 votes |
@Override protected void setThreshold() { noOfEdges = 0; threshold = 0; int limit = cleanCleanER ? datasetLimit : noOfEntities; if (weightingScheme.equals(WeightingScheme.ARCS)) { for (int i = 0; i < limit; i++) { processArcsEntity(i); updateThreshold(i); } } else { for (int i = 0; i < limit; i++) { processEntity(i); updateThreshold(i); } } threshold /= noOfEdges; Log.info("Edge Pruning Weight Threshold\t:\t" + threshold); }
Example #9
Source File: GroundTruthIndex.java From JedAIToolkit with Apache License 2.0 | 6 votes |
public boolean isRepeated(int blockIndex, Comparison comparison) { final int[] blocks1 = entityBlocks[comparison.getEntityId1()]; final int[] blocks2 = entityBlocks[comparison.getEntityId2() + datasetLimit]; for (int item : blocks1) { for (int value : blocks2) { if (value < item) { continue; } if (item < value) { break; } if (item == value) { return item != blockIndex; } } } Log.error("Error!!!!"); return false; }
Example #10
Source File: AbstractReader.java From JedAIToolkit with Apache License 2.0 | 6 votes |
public static Object loadSerializedObject(String fileName) { Object object; try { final InputStream file = new FileInputStream(fileName); final InputStream buffer = new BufferedInputStream(file); try (ObjectInput input = new ObjectInputStream(buffer)) { object = input.readObject(); } } catch (ClassNotFoundException cnfEx) { Log.error("Missing class", cnfEx); return null; } catch (IOException ioex) { Log.error("Error in data reading", ioex); return null; } return object; }
Example #11
Source File: GtRDFReader.java From JedAIToolkit with Apache License 2.0 | 6 votes |
protected void getUnilateralConnectedComponents(List<Set<Integer>> connectedComponents) { for (Set<Integer> cluster : connectedComponents) { if (cluster.size() < 2) { Log.warn("Connected component with a single element!" + cluster.toString()); continue; } // add a new pair of IdDuplicates for every pair of entities in the cluster int clusterSize = cluster.size(); final Integer[] clusterEntities = cluster.toArray(new Integer[clusterSize]); for (int i = 0; i < clusterSize; i++) { for (int j = i + 1; j < clusterSize; j++) { idDuplicates.add(new IdDuplicates(clusterEntities[i], clusterEntities[j])); } } } }
Example #12
Source File: GenerateBoards.java From storm-example with Apache License 2.0 | 6 votes |
@Override public void execute(TridentTuple tuple, TridentCollector collector) { GameState gameState = (GameState) tuple.get(0); Board currentBoard = gameState.getBoard(); List<Board> history = new ArrayList<Board>(); history.addAll(gameState.getHistory()); history.add(currentBoard); if (!currentBoard.isEndState()) { String nextPlayer = Player.next(gameState.getPlayer()); List<Board> boards = gameState.getBoard().nextBoards(nextPlayer); Log.debug("Generated [" + boards.size() + "] children boards for [" + gameState.toString() + "]"); for (Board b : boards) { GameState newGameState = new GameState(b, history, nextPlayer); List<Object> values = new ArrayList<Object>(); values.add(newGameState); collector.emit(values); } } else { Log.debug("End game found! [" + currentBoard + "]"); } }
Example #13
Source File: GtCSVReader.java From JedAIToolkit with Apache License 2.0 | 6 votes |
protected void getUnilateralConnectedComponents(List<Set<Integer>> connectedComponents) { for (Set<Integer> cluster : connectedComponents) { if (cluster.size() < 2) { Log.warn("Connected component with a single element! " + cluster.toString()); continue; } // add a new pair of IdDuplicates for every pair of entities in the cluster int clusterSize = cluster.size(); Integer[] clusterEntities = cluster.toArray(new Integer[clusterSize]); for (int i = 0; i < clusterSize; i++) { for (int j = i + 1; j < clusterSize; j++) { idDuplicates.add(new IdDuplicates(clusterEntities[i], clusterEntities[j])); } } } }
Example #14
Source File: EntityRDFReader.java From JedAIToolkit with Apache License 2.0 | 6 votes |
@Override public List<EntityProfile> getEntityProfiles() { if (!entityProfiles.isEmpty()) { return entityProfiles; } if (inputFilePath == null) { Log.error("Input file path has not been set!"); return null; } //load the rdf model from the input file try { final Model model = RDFDataMgr.loadModel(inputFilePath); readModel(model); } catch (IOException ex) { Log.error("Error in entities reading!", ex); return null; } return entityProfiles; }
Example #15
Source File: EntityDBReader.java From JedAIToolkit with Apache License 2.0 | 6 votes |
private Connection getPostgreSQLconnection(String dbURL) throws IOException { try { final Properties props = new Properties(); if (!(user == null)) { props.setProperty("user", user); } if (!(password == null)) { props.setProperty("password", password); } if (ssl) { props.setProperty("ssl", "true"); } return DriverManager.getConnection("jdbc:" + dbURL, props); } catch (SQLException ex) { Log.error("Error with database connection!", ex); return null; } }
Example #16
Source File: EntitySPARQLReader.java From JedAIToolkit with Apache License 2.0 | 6 votes |
@Override public List<EntityProfile> getEntityProfiles() { if (!entityProfiles.isEmpty()) { return entityProfiles; } if (inputFilePath == null) { Log.error("Input file path has not been set!"); return null; } //load the rdf model from the input file try { readEndpoint(inputFilePath); } catch (IOException ex) { Log.error("Error in data reading", ex); return null; } return entityProfiles; }
Example #17
Source File: ProgressiveBlockScheduling.java From JedAIToolkit with Apache License 2.0 | 6 votes |
@Override public void developBlockBasedSchedule(List<AbstractBlock> blocks) { if (blocks == null || blocks.isEmpty()) { Log.error("No blocks were given as input!"); System.exit(-1); } blocks.sort(new IncBlockCardinalityComparator()); blocksArray = blocks.toArray(new AbstractBlock[0]); isDecomposedBlock = blocksArray[0] instanceof DecomposedBlock; if (!isDecomposedBlock) { entityIndex = new BlockcentricEntityIndex(blocks, wScheme); } blockCounter = 0; comparisonCounter = 0; filterComparisons(); }
Example #18
Source File: ProgressiveGlobalTopComparisons.java From JedAIToolkit with Apache License 2.0 | 6 votes |
@Override public void developBlockBasedSchedule(List<AbstractBlock> blocks) { if (blocks == null || blocks.isEmpty()) { Log.error("No blocks were given as input!"); System.exit(-1); } if (blocks.get(0) instanceof DecomposedBlock) { Log.warn("Decomposed blocks were given as input!"); Log.warn("The pre-computed comparison weights will be used!"); compIterator = processDecomposedBlocks(blocks); } else { final ProgressiveCEP pcep = new ProgressiveCEP(comparisonsBudget, wScheme); pcep.refineBlocks(blocks); compIterator = pcep.getTopComparisons().iterator(); } }
Example #19
Source File: PretrainedCharacterVectors.java From JedAIToolkit with Apache License 2.0 | 6 votes |
float[] createCharacterWordVector(String token) { float[] char_word_vector = getZeroVector(); int num_token_chars = 0; int char_idx = 0; for (char c : token.toCharArray()) { char_idx++; if (elementMap.containsKey(Character.toString(c))) { Log.debug(String.format("Adding char %d/%d : %c from token %s to vector.", char_idx, token.length(), c, token)); num_token_chars++; addCharacterVector(elementMap.get(Character.toString(c)), char_word_vector); } else { handleUnknown(token); } } if (num_token_chars == 0) { return null; } // normalize Log.debug(String.format("Averaging character embedding from %d characters", num_token_chars)); for (int i = 0; i < dimension; ++i) { char_word_vector[i] /= num_token_chars; } return char_word_vector; }
Example #20
Source File: GraphModel.java From JedAIToolkit with Apache License 2.0 | 6 votes |
@Override public float getSimilarity(ITextModel oModel) { final GraphSimilarity graphSimilarity = COMPARATOR.getSimilarityBetween(this.getGraphModel(), ((GraphModel) oModel).getGraphModel()); switch (simMetric) { case GRAPH_CONTAINMENT_SIMILARITY: return (float)graphSimilarity.ContainmentSimilarity; case GRAPH_NORMALIZED_VALUE_SIMILARITY: if (0 < graphSimilarity.SizeSimilarity) { return (float)(graphSimilarity.ValueSimilarity / graphSimilarity.SizeSimilarity); } case GRAPH_VALUE_SIMILARITY: return (float)graphSimilarity.ValueSimilarity; case GRAPH_OVERALL_SIMILARITY: float overallSimilarity = (float) graphSimilarity.ContainmentSimilarity; overallSimilarity += graphSimilarity.ValueSimilarity; if (0 < graphSimilarity.SizeSimilarity) { overallSimilarity += graphSimilarity.ValueSimilarity / graphSimilarity.SizeSimilarity; return (float)(overallSimilarity / 3); } return (float)(overallSimilarity / 2); default: Log.error("The given similarity metric is incompatible with the n-gram graphs representation model!"); System.exit(-1); return -1; } }
Example #21
Source File: EntityHDTRDFReader.java From JedAIToolkit with Apache License 2.0 | 6 votes |
@Override public List<EntityProfile> getEntityProfiles() { if (!entityProfiles.isEmpty()) { return entityProfiles; } if (inputFilePath == null) { Log.error("Input file path has not been set!"); return null; } //load the rdf model from the input file try { readModel(inputFilePath); } catch (IOException ex) { Log.error("Error in entities reading!", ex); return null; } catch (NotFoundException e) { Log.error(e.getMessage()); } return entityProfiles; }
Example #22
Source File: BlocksPerformanceWriter.java From JedAIToolkit with Apache License 2.0 | 6 votes |
public void setStatistics() { if (blocks.isEmpty()) { Log.warn("Empty set of blocks was given as input!"); return; } setType(); setComparisonsCardinality(); if (blocks.get(0) instanceof DecomposedBlock) { getDecomposedBlocksEntities(); } else { entityIndex = new GroundTruthIndex(blocks, abstractDP.getDuplicates()); getEntities(); } if (blocks.get(0) instanceof BilateralBlock) { getBilateralBlockingCardinality(); } if (blocks.get(0) instanceof DecomposedBlock) { getDuplicatesOfDecomposedBlocks(); } else { getDuplicatesWithEntityIndex(); } }
Example #23
Source File: CharacterNGramsWithGlobalWeights.java From JedAIToolkit with Apache License 2.0 | 6 votes |
protected float getARCSSimilarity(CharacterNGramsWithGlobalWeights oModel) { final Set<String> commonKeys = new HashSet(itemsFrequency.keySet()); commonKeys.retainAll(oModel.getItemsFrequency().keySet()); float similarity = 0; if (datasetId == DATASET_1 && datasetId == oModel.getDatasetId()) { // Dirty ER similarity = commonKeys.stream().map((key) -> DOC_FREQ[DATASET_1].get(key)).map((frequency) -> 1.0f / ((float) Math.log1p(frequency * (frequency - 1.0f) / 2.0f) / (float) Math.log(2))).reduce(similarity, (accumulator, _item) -> accumulator + _item); } else if (datasetId != oModel.getDatasetId()) { // Clean-Clean ER similarity = commonKeys.stream().map((key) -> 1.0f / ((float) Math.log1p(((float) DOC_FREQ[DATASET_1].get(key)) * DOC_FREQ[DATASET_2].get(key)) / (float) Math.log(2))).reduce(similarity, (accumulator, _item) -> accumulator + _item); } else { Log.error("Both models come from dataset 1!"); System.exit(-1); } return similarity; }
Example #24
Source File: TokenNGramsWithGlobalWeights.java From JedAIToolkit with Apache License 2.0 | 6 votes |
@Override public float getSimilarity(ITextModel oModel) { switch (simMetric) { case ARCS_SIMILARITY: return getARCSSimilarity((TokenNGramsWithGlobalWeights) oModel); case COSINE_SIMILARITY: return getTfIdfCosineSimilarity((TokenNGramsWithGlobalWeights) oModel); case GENERALIZED_JACCARD_SIMILARITY: return getTfIdfGeneralizedJaccardSimilarity((TokenNGramsWithGlobalWeights) oModel); case SIGMA_SIMILARITY: return getSigmaSimilarity((TokenNGramsWithGlobalWeights) oModel); default: Log.error("The given similarity metric is incompatible with the bag representation model!"); System.exit(-1); return -1; } }
Example #25
Source File: EntityJSONRDFReader.java From JedAIToolkit with Apache License 2.0 | 6 votes |
@Override public List<EntityProfile> getEntityProfiles() { if (!entityProfiles.isEmpty()) { return entityProfiles; } if (inputFilePath == null) { Log.error("Input file path has not been set!"); return null; } //load the rdf model from the input file try { readModel(inputFilePath); } catch (IOException ex) { Log.error("Error in entities reading!", ex); return null; } catch (NotFoundException e) { Log.error(e.getMessage()); } return entityProfiles; }
Example #26
Source File: CharacterNGramsWithGlobalWeights.java From JedAIToolkit with Apache License 2.0 | 5 votes |
protected float getIdfWeight(String keyValue) { int frequency = DOC_FREQ[datasetId].get(keyValue); if (frequency == 0) { return 0; } if (NO_OF_DOCUMENTS[datasetId] < frequency) { Log.error("Error in the computation of IDF weights!!!"); return 0; } return (float) Math.log10(NO_OF_DOCUMENTS[datasetId] / (1.0f + frequency)); }
Example #27
Source File: EntityDBReader.java From JedAIToolkit with Apache License 2.0 | 5 votes |
private Connection getMySQLconnection(String dbURL) throws IOException { try { Class.forName("com.mysql.jdbc.Driver"); return DriverManager.getConnection("jdbc:" + dbURL + "?user=" + user + "&password=" + password); } catch (Exception ex) { Log.error("Error with database connection!", ex); return null; } }
Example #28
Source File: EntitySerializationReader.java From JedAIToolkit with Apache License 2.0 | 5 votes |
@Override public List<EntityProfile> getEntityProfiles() { if (!entityProfiles.isEmpty()) { return entityProfiles; } if (inputFilePath == null) { Log.error("Input file path has not been set!"); return null; } entityProfiles.addAll((List<EntityProfile>) loadSerializedObject(inputFilePath)); return entityProfiles; }
Example #29
Source File: PrintStatsToFile.java From JedAIToolkit with Apache License 2.0 | 5 votes |
public void printToCSV(String filename) throws FileNotFoundException { final PrintWriter pw = new PrintWriter(new File(filename)); final StringBuilder sb = new StringBuilder(); sb.append("cluster_id,dataset,entity_url\n"); int counter = 0; for (EquivalenceCluster eqc : entityClusters) { if (eqc.getEntityIdsD1().isEmpty()) { continue; } counter++; for (TIntIterator iterator = eqc.getEntityIdsD1().iterator(); iterator.hasNext(); ) { sb.append(counter).append(",").append(1).append(",") .append(profilesD1.get(iterator.next()).getEntityUrl()).append("\n"); } if (eqc.getEntityIdsD2().isEmpty()) { continue; } if (profilesD2 == null) { Log.error("The entity profiles of Dataset 2 are missing!"); continue; } for (TIntIterator iterator = eqc.getEntityIdsD2().iterator(); iterator.hasNext(); ) { sb.append(counter).append(",").append(2).append(",") .append(profilesD2.get(iterator.next()).getEntityUrl()).append("\n"); } } pw.write(sb.toString()); pw.close(); }
Example #30
Source File: SimilarityPairs.java From JedAIToolkit with Apache License 2.0 | 5 votes |
private float countComparisons(List<AbstractBlock> blocks) { float comparisons = 0; comparisons = blocks.stream().map((block) -> block.getNoOfComparisons()).reduce(comparisons, (accumulator, _item) -> accumulator + _item); if (MAX_COMPARISONS < comparisons) { Log.error("Very high number of comparisons to be executed! " + "Maximum allowed number is : " + MAX_COMPARISONS); System.exit(-1); } return comparisons; }