本文整理汇总了Java中com.esotericsoftware.minlog.Log类的典型用法代码示例。如果您正苦于以下问题:Java Log类的具体用法?Java Log怎么用?Java Log使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Log类属于com.esotericsoftware.minlog包,在下文中一共展示了Log类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sendAckInfoToCtrlTopic
import com.esotericsoftware.minlog.Log; //导入依赖的package包/类
private static void sendAckInfoToCtrlTopic(String dataSourceInfo, String completedTime, String pullStatus) {
try {
// 在源dataSourceInfo的基础上,更新全量拉取相关信息。然后发回src topic
JSONObject jsonObj = JSONObject.parseObject(dataSourceInfo);
jsonObj.put(DataPullConstants.FullPullInterfaceJson.FROM_KEY, DataPullConstants.FullPullInterfaceJson.FROM_VALUE);
jsonObj.put(DataPullConstants.FullPullInterfaceJson.TYPE_KEY, DataPullConstants.FullPullInterfaceJson.TYPE_VALUE);
// notifyFullPullRequestor
JSONObject payloadObj = jsonObj.getJSONObject(DataPullConstants.FullPullInterfaceJson.PAYLOAD_KEY);
// 完成时间
payloadObj.put(DataPullConstants.FullPullInterfaceJson.COMPLETE_TIME_KEY, completedTime);
// 拉取是否成功标志位
payloadObj.put(DataPullConstants.FullPullInterfaceJson.DATA_STATUS_KEY, pullStatus);
jsonObj.put(DataPullConstants.FullPullInterfaceJson.PAYLOAD_KEY, payloadObj);
String ctrlTopic = getFullPullProperties(Constants.ZkTopoConfForFullPull.COMMON_CONFIG, true)
.getProperty(Constants.ZkTopoConfForFullPull.FULL_PULL_SRC_TOPIC);
Producer producer = DbusHelper
.getProducer(getFullPullProperties(Constants.ZkTopoConfForFullPull.BYTE_PRODUCER_CONFIG, true));
ProducerRecord record = new ProducerRecord<>(ctrlTopic, DataPullConstants.FullPullInterfaceJson.TYPE_VALUE, jsonObj.toString().getBytes());
Future<RecordMetadata> future = producer.send(record);
RecordMetadata meta = future.get();
}
catch (Exception e) {
Log.error("Error occurred when report full data pulling status.", e);
throw new RuntimeException(e);
}
}
示例2: startCommandHandlerOnNewThread
import com.esotericsoftware.minlog.Log; //导入依赖的package包/类
private void startCommandHandlerOnNewThread()
{
Log.info("NOTE: you can now type commands here.");
CommandHandler commandHandler = new CommandHandler();
Runnable commandHandlingTask = () ->
{
try (Scanner scanner = new Scanner(System.in))
{
while (true)
{
String command = scanner.nextLine();
commandHandler.handle(command);
}
}
};
new Thread(commandHandlingTask).start();
}
示例3: processSingle
import com.esotericsoftware.minlog.Log; //导入依赖的package包/类
private void processSingle(OntModel m) {
for (Iterator<?> i = m.listClasses(); i.hasNext(); ) {
OntClass c = (OntClass) i.next();
try {
// too confusing to list all the restrictions as root classes
if (c.isAnon()) {
continue;
}
if (c.hasSuperClass(m.getProfile().THING(), true) || c.getCardinality(m.getProfile().SUB_CLASS_OF()) == 0) {
// this class is directly descended from Thing
roots.add(c);
}
} catch (Exception e) {
Log.error("Error during extraction or root Classes from Ontology Model: ", e);
}
}
}
示例4: printMatrixInDenseTextFormat
import com.esotericsoftware.minlog.Log; //导入依赖的package包/类
/**
* Writes the matrix in a Dense text format
*/
public static void printMatrixInDenseTextFormat(org.apache.spark.mllib.linalg.Matrix m, String outputPath) {
try {
FileWriter fileWriter = new FileWriter(outputPath);
PrintWriter printWriter= new PrintWriter(fileWriter);
for(int i=0; i < m.numRows(); i++)
{
for(int j=0; j < m.numCols(); j++)
{
printWriter.print(m.apply(i, j) + " ");
}
printWriter.println();
}
printWriter.close();
fileWriter.close();
}
catch (Exception e) {
Log.error("Output file " + outputPath + " not found ");
}
}
示例5: printMatrixInCoordinateFormat
import com.esotericsoftware.minlog.Log; //导入依赖的package包/类
/**
* Writes the matrix in a Coordinate list (COO) format
*/
public static void printMatrixInCoordinateFormat(org.apache.spark.mllib.linalg.Matrix m, String outputPath) {
try
{
FileWriter fileWriter = new FileWriter(outputPath);
PrintWriter printWriter= new PrintWriter(fileWriter);
double val;
for(int i=0; i < m.numRows(); i++)
{
for(int j=0; j < m.numCols(); j++)
{
val=m.apply(i, j);
if(val!=0)
printWriter.println(i + "," + j + "," + val);
}
}
printWriter.close();
fileWriter.close();
}
catch (Exception e) {
Log.error("Output file " + outputPath + " not found ");
}
}
示例6: getBiomeLegend
import com.esotericsoftware.minlog.Log; //导入依赖的package包/类
/**
* Create a map of all Biomes, mapping the biome name to the url of the biome image.
* The map is ordered by its keys.
* @return
*/
private static Map<String, String> getBiomeLegend() {
Map<String, String> result = new TreeMap<>();
// Get list of all biomeicons in 32px folder
File tilesDir = Paths.get(Uristmaps.conf.fetch("Paths", "tiles"), "32").toFile();
for (File tileFile : tilesDir.listFiles(filename -> filename.getName().endsWith(".png"))) {
String biomeName = FilenameUtils.removeExtension(tileFile.getName());
if (biomeName.startsWith("castle") || biomeName.startsWith("village")
|| biomeName.startsWith("river") || biomeName.startsWith("wall")
|| biomeName.startsWith("road") || biomeName.startsWith("tunnel")
|| biomeName.startsWith("farmland") || biomeName.startsWith("bridge")) {
Log.trace("TemplateRenderer", "Skipping " + biomeName + " in biome legend.");
continue;
}
// Add icon under the biome name to the result map.
result.put(WordUtils.capitalize(biomeName.replace("_", " ")), "biome_legend/" + tileFile.getName().replace(" ", "_"));
}
return result;
}
示例7: loadSitemaps
import com.esotericsoftware.minlog.Log; //导入依赖的package包/类
/**
* DOCME
* @return
*/
private static Map<Integer, SitemapInfo> loadSitemaps() {
File sitemapsFile = BuildFiles.getSitemapsIndex();
try (Input input = new Input(new FileInputStream(sitemapsFile))) {
return Uristmaps.kryo.readObject(input, HashMap.class);
} catch (Exception e) {
Log.warn("WorldSites", "Error when reading sitemaps index file: " + sitemapsFile);
if (sitemapsFile.exists()) {
// This might have happened because an update changed the class and it can no longer be read
// remove the file and re-generate it in the next run.
sitemapsFile.delete();
Log.info("WorldSites", "The file has been removed. Please try again.");
}
System.exit(1);
}
return null;
}
示例8: testExtractScriptFile
import com.esotericsoftware.minlog.Log; //导入依赖的package包/类
@Test
public void testExtractScriptFile() throws IOException {
File[] mpqs = getMpqs();
for (File mpq : mpqs) {
Log.info("test extract script: " + mpq.getName());
JMpqEditor mpqEditor = new JMpqEditor(mpq, MPQOpenOption.READ_ONLY, MPQOpenOption.FORCE_V0);
File temp = File.createTempFile("war3mapj", "extracted", JMpqEditor.tempDir);
temp.deleteOnExit();
if (mpqEditor.hasFile("war3map.j")) {
String extractedFile = mpqEditor.extractFileAsString("war3map.j").replaceAll("\\r\\n", "\n").replaceAll("\\r", "\n");
String existingFile = new String(Files.readAllBytes(getFile("war3map.j").toPath())).replaceAll("\\r\\n", "\n").replaceAll("\\r", "\n");
Assert.assertEquals(existingFile, extractedFile);
}
mpqEditor.close();
}
}
示例9: testRemoveHeaderoffset
import com.esotericsoftware.minlog.Log; //导入依赖的package包/类
@Test(enabled = false)
public void testRemoveHeaderoffset() throws IOException {
File[] mpqs = getMpqs();
File mpq = null;
for (File mpq1 : mpqs) {
if (mpq1.getName().startsWith("normal")) {
mpq = mpq1;
break;
}
}
Assert.assertNotNull(mpq);
Log.info(mpq.getName());
JMpqEditor mpqEditor = new JMpqEditor(mpq, MPQOpenOption.FORCE_V0);
mpqEditor.setKeepHeaderOffset(false);
mpqEditor.close();
byte[] bytes = new byte[4];
new FileInputStream(mpq).read(bytes);
ByteBuffer order = ByteBuffer.wrap(bytes).order(ByteOrder.LITTLE_ENDIAN);
Assert.assertEquals(order.getInt(), JMpqEditor.ARCHIVE_HEADER_MAGIC);
mpqEditor = new JMpqEditor(mpq, MPQOpenOption.FORCE_V0);
Assert.assertTrue(mpqEditor.isCanWrite());
mpqEditor.close();
}
示例10: copy
import com.esotericsoftware.minlog.Log; //导入依赖的package包/类
/**
* Copies all site maps into the output directory to make them available for the web app.
*/
public static void copy() {
for (File imageFile : ExportFiles.getAllSitemaps()) {
// Resolve id of the site
Matcher matcher = idFind.matcher(imageFile.getName());
if (!matcher.find()) continue;
int id = Integer.parseInt(matcher.group(2));
// Copy the sitemap file into the output directory
try {
FileUtils.copyFile(imageFile, OutputFiles.getSiteMap(id));
} catch (IOException e) {
Log.error("SiteMaps", "Could not copy image file to: " + OutputFiles.getSiteMap(id));
if (Log.DEBUG) Log.debug("SiteMaps", "Exception", e);
System.exit(1);
}
}
}
示例11: run
import com.esotericsoftware.minlog.Log; //导入依赖的package包/类
public void run() {
while (mRunning) {
mLock.lock();
try {
if (mActionMaps.isEmpty()) {
mCondVar.await();
}
while (mRunning && !mActionMaps.isEmpty()) {
mActionMaps.pop().run();
}
} catch (InterruptedException e) {
Log.error("Service", e);
} finally {
mLock.unlock();
}
}
}
示例12: getBiomeData
import com.esotericsoftware.minlog.Log; //导入依赖的package包/类
/**
* Call this to retrieve the biome data.
* This info is cached after the first call.
* @return
*/
public static String[][] getBiomeData() {
if (biomeData != null) {
return biomeData;
}
// TODO: Reading from the image might be faster than this kryo import.
File biomeInfoFile = BuildFiles.getBiomeInfo();
try (Input input = new Input(new FileInputStream(biomeInfoFile))) {
biomeData = Uristmaps.kryo.readObject(input, String[][].class);
return biomeData;
} catch (Exception e) {
Log.warn("BiomeInfo", "Error when reading biome file: " + biomeInfoFile);
if (biomeInfoFile.exists()) {
// This might have happened because an update changed the class and it can no longer be read
// remove the file and re-generate it in the next run.
biomeInfoFile.delete();
Log.info("BiomeInfo", "The file has been removed. Please try again.");
}
System.exit(1);
}
return null;
}
示例13: getDate
import com.esotericsoftware.minlog.Log; //导入依赖的package包/类
/**
* Find the date of the export files. Either this is set in the config or the latest date
* is resolved using the legends.xml file with the latest date.
* @return
*/
public static String getDate() {
if (timeStamp == null) {
String config = conf.get("Paths", "region_date");
if (config.equals("@LATEST")) {
// Find all *-legends.xml files
File[] populationFiles = new File(conf.fetch("Paths", "export")).listFiles(
(dir, name) -> name.startsWith(conf.get("Paths", "region_name"))
&& name.endsWith("-legends.xml"));
// Find the maximum date string within these filenames
String maxDate = "00000-00-00";
for (File popFile : populationFiles) {
String fileName = popFile.getName();
String date = fileName.replace(conf.get("Paths", "region_name") + "-", "").replace("-legends.xml", "");
if (maxDate.compareTo(date) < 0) maxDate = date;
}
timeStamp = maxDate;
Log.info("ExportFiles", "Resolved date to " + maxDate);
} else {
// Use the config as provided
timeStamp = config;
}
}
return timeStamp;
}
示例14: main
import com.esotericsoftware.minlog.Log; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
Log.set(com.esotericsoftware.minlog.Log.LEVEL_INFO);
avoidTheLine(100,
Paths.get("inputs","paper_synthesis"),
Paths.get("runs","paper_synthesis"));
/*
thresholdSweeps(25,
Paths.get("inputs","paper_synthesis"),
Paths.get("runs","paper_synthesis")
);
thresholdProbabilitySweeps(25,
Paths.get("inputs","paper_synthesis"),
Paths.get("runs","paper_synthesis")
);
socialAnnealing(25,
Paths.get("inputs","paper_synthesis"),
Paths.get("runs","paper_synthesis")
);
*/
}
示例15: multiTAC
import com.esotericsoftware.minlog.Log; //导入依赖的package包/类
@Test
public void multiTAC() throws Exception
{
FishYAML yaml = new FishYAML();
Log.info("This test tries to read \n" + yaml.dump(factory) + "\n as a TAC quota");
factory.setQuotaType(MultiQuotaMapFactory.QuotaType.TAC);
MultiQuotaRegulation apply = factory.apply(state);
verify(state,never()).registerStartable(any(ITQScaler.class));
Log.info("the test read the following string: " + factory.getConvertedInitialQuotas());
assertEquals(1000d,apply.getYearlyQuota()[0],.0001);
assertEquals(10d,apply.getYearlyQuota()[2],.0001);
assertTrue(Double.isInfinite(apply.getYearlyQuota()[1]));
assertEquals(1000d,apply.getQuotaRemaining(0),.0001);
assertEquals(10d,apply.getQuotaRemaining(2),.0001);
assertTrue(Double.isInfinite(apply.getYearlyQuota()[1]));
}