本文整理汇总了Java中org.pmw.tinylog.Level类的典型用法代码示例。如果您正苦于以下问题:Java Level类的具体用法?Java Level怎么用?Java Level使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Level类属于org.pmw.tinylog包,在下文中一共展示了Level类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listExamples
import org.pmw.tinylog.Level; //导入依赖的package包/类
public List<File> listExamples(final File folder) {
Configurator.defaultConfig()
.writer(new FileWriter(logFile))
.level(Level.INFO)
.activate();
Logger.error("ENTER LIST EXAMPLES");
List<File> directories = new ArrayList<File> ();
for (final File fileEntry : folder.listFiles()) {
Logger.error("Listando"+ fileEntry.getAbsolutePath());
if (fileEntry.isDirectory()) {
directories.add(fileEntry);
}
}
Logger.error("EXIT LIST EXAMPLES");
return directories;
}
示例2: initMaps
import org.pmw.tinylog.Level; //导入依赖的package包/类
/** Prepares the map with data that shall replace the pre-/post level tags.
* @param preTrace the 'trace' data for pre-level tag
* @param preDebug the 'debug' data for pre-level tag
* @param preInfo the 'info' data for pre-level tag
* @param preWarn the 'warn' data for pre-level tag
* @param preError the 'error' data for pre-level tag
* @param postTrace the 'trace' data for post-level tag
* @param postDebug the 'debug' data for post-level tag
* @param postInfo the 'info' data for post-level tag
* @param postWarn the 'warn' data for post-level tag
* @param postError the 'error' data for post-level tag
*/
private void initMaps(
String preTrace, String preDebug, String preInfo, String preWarn, String preError,
String postTrace, String postDebug, String postInfo, String postWarn, String postError ) {
preLevelParams = new HashMap<Level, String>();
postLevelParams = new HashMap<Level, String>();
preLevelParams.put(Level.TRACE, ( preTrace == null ? "" : preTrace) );
preLevelParams.put(Level.DEBUG, ( preDebug == null ? "" : preDebug) );
preLevelParams.put(Level.INFO, ( preInfo == null ? "" : preInfo) );
preLevelParams.put(Level.WARNING, ( preWarn == null ? "" : preWarn) );
preLevelParams.put(Level.ERROR, ( preError == null ? "" : preError) );
postLevelParams.put(Level.TRACE, ( postTrace == null ? "" : postTrace) );
postLevelParams.put(Level.DEBUG, ( postDebug == null ? "" : postDebug) );
postLevelParams.put(Level.INFO, ( postInfo == null ? "" : postInfo) );
postLevelParams.put(Level.WARNING, ( postWarn == null ? "" : postWarn) );
postLevelParams.put(Level.ERROR, ( postError == null ? "" : postError) );
}
示例3: postStatementExecution
import org.pmw.tinylog.Level; //导入依赖的package包/类
protected void postStatementExecution(CassandraCqlStatement parsedStmt, ResultSet rs) {
if (LOG_LEVEL.compareTo(Level.DEBUG) >= 0 && rs != null) {
List<ExecutionInfo> list = rs.getAllExecutionInfo();
int size = list == null ? 0 : list.size();
if (size > 0) {
int index = 1;
for (ExecutionInfo info : rs.getAllExecutionInfo()) {
Logger.debug(getExecutionInfoAsString(info, index, size));
QueryTrace q = info.getQueryTrace();
if (parsedStmt.getConfiguration().tracingEnabled() && q != null) {
Logger.debug(getQueryTraceAsString(q, index, size));
}
index++;
}
Logger.debug("Executed successfully with results: {}", !rs.isExhausted());
}
}
replaceCurrentResultSet(parsedStmt, rs);
}
示例4: DummyCassandraResultSet
import org.pmw.tinylog.Level; //导入依赖的package包/类
/**
* This creates a result set based on given data and column definitions.
*
* @param columns column definitions, name and its Cql type
* @param data rows
*/
public DummyCassandraResultSet(String[][] columns, Object[][] data) {
super(null, null);
Logger.trace("Constructing dummy result set @{}...", hashCode());
if (columns != null && columns.length > 0 && columns[0].length > 1) {
for (String[] column : columns) {
Logger.trace("* Column: {name={}, cqlType={}}", column[0], column[1]);
metadata.addColumnDefinition(new CassandraColumnDefinition(
null, null, column[0], column[1], false));
}
}
this.data = data == null ? new String[0][] : data;
if (LOG_LEVEL.compareTo(Level.TRACE) >= 0) {
for (Object[] row : this.data) {
Logger.trace("* Row: {}", Arrays.toString(row));
}
}
Logger.trace("Dummy result set @{} is ready for use", hashCode());
}
示例5: getPrintStream
import org.pmw.tinylog.Level; //导入依赖的package包/类
/** Get the {@link PrintStream} for the indicated Level.
* @param level the log level
* @return {@link PrintStream} for the log level to be used
*/
private PrintStream getPrintStream(final Level level) {
if (level == Level.ERROR || level == Level.WARNING) {
return err;
} else {
return out;
}
}
示例6: setupBatchLogConfig
import org.pmw.tinylog.Level; //导入依赖的package包/类
private static void setupBatchLogConfig() {
Configurator.defaultConfig()
.writer(new RollingFileWriter(PropertiesRepo.get(Constants.Settings.LOG_PATH) + File.separator + "data-import.log", 10, new CountLabeler(), new SizePolicy(1024 * 1024 * 100)))
//.addWriter(new ConsoleWriter())
.level(Level.valueOf(PropertiesRepo.get(Constants.Settings.LOG_LEVEL)))
.formatPattern(PropertiesRepo.get(Constants.Settings.LOG_PATTERN))
.activate();
}
示例7: setupEngineLogConfig
import org.pmw.tinylog.Level; //导入依赖的package包/类
private static void setupEngineLogConfig() {
Configurator.defaultConfig()
.writer(new RollingFileWriter(PropertiesRepo.get(Constants.Settings.LOG_PATH) + File.separator + "matching-engine.log", 10, new CountLabeler(), new SizePolicy(1024 * 1024 * 100)))
//.addWriter(new ConsoleWriter())
.level(Level.valueOf(PropertiesRepo.get(Constants.Settings.LOG_LEVEL)))
.formatPattern(PropertiesRepo.get(Constants.Settings.LOG_PATTERN))
.activate();
}
示例8: init
import org.pmw.tinylog.Level; //导入依赖的package包/类
public void init(String outputDir, RunnerTestResults runnerTestResults, File chromeExecutable) {
this.runnerTestResults = runnerTestResults;
this.chromeExecutable = chromeExecutable;
this.outputDir = new File(outputDir);
this.outputDir.mkdirs();
Configurator.defaultConfig()
.writer(new FileWriter(new File(this.outputDir, "log.txt").getAbsolutePath()))
.level(Level.INFO)
.activate();
}
示例9: toGelfMessageLevel
import org.pmw.tinylog.Level; //导入依赖的package包/类
private GelfMessageLevel toGelfMessageLevel(final Level level) {
switch (level) {
case TRACE:
case DEBUG:
return GelfMessageLevel.DEBUG;
case INFO:
return GelfMessageLevel.INFO;
case WARNING:
return GelfMessageLevel.WARNING;
case ERROR:
return GelfMessageLevel.ERROR;
default:
throw new IllegalArgumentException("Invalid log level " + level);
}
}
示例10: testClose
import org.pmw.tinylog.Level; //导入依赖的package包/类
@Test
public void testClose() throws Exception {
final GelfWriter gelfWriter = new GelfWriter();
Configurator.defaultConfig()
.writer(gelfWriter)
.level(Level.INFO)
.activate();
gelfWriter.close();
}
示例11: testLogging
import org.pmw.tinylog.Level; //导入依赖的package包/类
@Test
public void testLogging() {
Configurator.defaultConfig()
.writer(new GelfWriter("localhost"))
.addWriter(new ConsoleWriter())
.level(Level.TRACE)
.activate();
@SuppressWarnings("all")
final RuntimeException exception = new RuntimeException("BOOM!");
exception.fillInStackTrace();
Logger.trace("Test");
Logger.trace(exception, "Test");
Logger.trace("Test {}", 1234);
Logger.debug("Test");
Logger.debug(exception, "Test");
Logger.debug("Test {}", 1234);
Logger.info("Test");
Logger.info(exception, "Test");
Logger.info("Test {}", 1234);
Logger.warn("Test");
Logger.warn(exception, "Test");
Logger.warn("Test {}", 1234);
Logger.error("Test");
Logger.error(exception, "Test");
Logger.error("Test {}", 1234);
}
示例12: main
import org.pmw.tinylog.Level; //导入依赖的package包/类
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Configurator.defaultConfig()
.writer(new FileWriter("poemstarlog.txt"))
.level(Level.INFO)
.activate();
MainJDialog dlg = new MainJDialog(null, true);
dlg.setVisible(true);
}
示例13: configureLog
import org.pmw.tinylog.Level; //导入依赖的package包/类
private static void configureLog() {
Configurator.defaultConfig().writer(new org.pmw.tinylog.writers.FileWriter(LOG_FILE))
.level(Level.INFO).activate();
}
示例14: getExamples
import org.pmw.tinylog.Level; //导入依赖的package包/类
public List<Example> getExamples(){
Configurator.defaultConfig()
.writer(new FileWriter(logFile))
.level(Level.INFO)
.activate();
Logger.error("ENTER GET EXAMPLES");
Logger.error("Examples folder src: "+baseDir + "examples");
// Cleaning up:
String outputFromClean = executeCommand("rm -rf "+baseDir + "examples/"+"CUSTOM_*");
final File examplesFolder = new File(baseDir + "examples");
List<File> examplesDirectories = listExamples(examplesFolder);
Logger.error("Obtengo: "+ examplesDirectories.size() + " directorios");
List<Example> examples = new ArrayList<Example>();
for (final File exampleDirectory : examplesDirectories) {
Logger.error("Procesando: "+ exampleDirectory.getAbsolutePath());
Example example1 = new Example();
ArrayList<JavaFile> files = new ArrayList<JavaFile>();
// TODO Important!!! the examples must use "jheaptest" as package
Logger.error("Leyendo ficheros java de "+ exampleDirectory.getAbsolutePath()+"/src/jheaptest");
List<File> exampleFiles = listExampleFiles(new File(exampleDirectory.getAbsolutePath()+"/src/jheaptest"));
for (final File exampleFile : exampleFiles){
Logger.error("Fichero: "+ exampleFile.getAbsolutePath());
JavaFile file1 = new JavaFile(exampleFile.getName(), readFile(exampleFile.getAbsolutePath()));
files.add(file1);
}
example1.setFiles(files);
Logger.error("Buscando Input en "+ exampleDirectory.getAbsolutePath()+"/input");
example1.setInput(readFile(exampleDirectory.getAbsolutePath()+"/input"));
example1.setReadme(readFile(exampleDirectory.getAbsolutePath()+"/README"));
example1.setName(exampleDirectory.getName());
// looking for vars
example1.setVars(readVars(exampleDirectory.getAbsolutePath()+"/vars"));
examples.add(example1);
}
Logger.error("END GET EXAMPLES");
return examples;
}
示例15: main
import org.pmw.tinylog.Level; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
// Get current Timestamp and Setup logger.
long timeInNanos = System.nanoTime();
String timeStamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss").format(new Date());
timeStamp += "." + ((int) (timeInNanos % 1000000000 / 100));
// Program start.
processArguments(args);
G.modelInstanceName = timeStamp;
G.outputDir = G.ns.getString("exec_dir") + "/" + timeStamp;
// Create Directory
Path dir = Paths.get(G.outputDir);
Files.createDirectories(dir);
System.out.println("------\nFLAGS\n------");
System.out.println("train-file: " + trainfile);
System.out.println("dev-file: " + valfile);
System.out.println("test-file: " + testfile);
System.out.println("hyper-parameter: " + HyperParameter.getInstance());
System.out.println("------\n");
Configurator.defaultConfig().writer(new FileWriter(G.outputDir + "/result.log"))
.level(Level.INFO).formatPattern("{level}\t{date}\t\t{message}").activate();
Logger.info(HyperParameter.getInstance());
Logger.info(trainfile + "\n");
DepPipe pipe = new DepPipe();
DepParserLauncher dp = null;
if (savedModel == null) {
DepInstance[] trainingData = pipe.createInstances(trainfile);
pipe.createAlphabet(trainingData);
dp = new DepParserLauncher(pipe);
int numFeats = pipe.featAlphabet.size();
int numReconsParentDim = dp.params.reconsParentAlphabet.size();
int numReconsChildDim = dp.params.reconsChildAlphabet.size();
System.out.println("Num Feats: " + numFeats);
System.out.println("Size of ReconsParent: " + numReconsParentDim);
System.out.println("Size of ReconsChild: " + numReconsChildDim);
// Training...
dp.train(trainingData);
} else {
dp = new DepParserLauncher(pipe);
dp.loadModel(savedModel);
}
// check dev accuracy.
if (valfile != null) {
dp.evaluatePerformance("Val", valfile, "10");
}
// check test accuracy.
if (testfile != null) {
dp.evaluatePerformance("Test", testfile, "10");
dp.evaluatePerformance("Test", testfile, "all");
}
dp.saveModel();
}