• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Level类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.pmw.tinylog.Level的典型用法代码示例。如果您正苦于以下问题:Java Level类的具体用法?Java Level怎么用?Java Level使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Level类属于org.pmw.tinylog包,在下文中一共展示了Level类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
 
开发者ID:mgbiedma,项目名称:java-heap-analyzer-api,代码行数:17,代码来源:ExamplesService.java


示例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) ); 

}
 
开发者ID:tobiasrm,项目名称:tinylog-coloredconsole,代码行数:33,代码来源:ColoredConsoleWriter.java


示例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);
}
 
开发者ID:zhicwu,项目名称:cassandra-jdbc-driver,代码行数:26,代码来源:CassandraStatement.java


示例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());
}
 
开发者ID:zhicwu,项目名称:cassandra-jdbc-driver,代码行数:31,代码来源:DummyCassandraResultSet.java


示例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;
	}
}
 
开发者ID:tobiasrm,项目名称:tinylog-coloredconsole,代码行数:12,代码来源:ColoredConsoleWriter.java


示例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();
}
 
开发者ID:nimesh-mittal,项目名称:elastic-match,代码行数:9,代码来源:StartupSettings.java


示例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();
}
 
开发者ID:nimesh-mittal,项目名称:elastic-match,代码行数:9,代码来源:StartupSettings.java


示例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();
}
 
开发者ID:loadtestgo,项目名称:pizzascript,代码行数:13,代码来源:Worker.java


示例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);
    }
}
 
开发者ID:joschi,项目名称:tinylog-gelf,代码行数:16,代码来源:GelfWriter.java


示例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();
}
 
开发者ID:joschi,项目名称:tinylog-gelf,代码行数:10,代码来源:GelfWriterTest.java


示例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);
}
 
开发者ID:joschi,项目名称:tinylog-gelf,代码行数:29,代码来源:GelfWriterTest.java


示例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);
}
 
开发者ID:rainrambler,项目名称:PoemStar,代码行数:14,代码来源:PoemStar.java


示例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();
}
 
开发者ID:CalebFenton,项目名称:apkfile,代码行数:5,代码来源:Main.java


示例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;

}
 
开发者ID:mgbiedma,项目名称:java-heap-analyzer-api,代码行数:49,代码来源:ExamplesService.java


示例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();
}
 
开发者ID:shtechair,项目名称:CRFAE-Dep-Parser,代码行数:66,代码来源:DepParserLauncher.java


示例16: info

import org.pmw.tinylog.Level; //导入依赖的package包/类
@Override
public void info(final String message, final Object... arguments) {
    LogEntryForwarder.forward(1, Level.INFO, null, message, arguments);
}
 
开发者ID:loadtestgo,项目名称:pizzascript,代码行数:5,代码来源:TinyLogger.java


示例17: warn

import org.pmw.tinylog.Level; //导入依赖的package包/类
@Override
public void warn(final String message, final Object... arguments) {
    LogEntryForwarder.forward(1, Level.WARNING, null, message, arguments);
}
 
开发者ID:loadtestgo,项目名称:pizzascript,代码行数:5,代码来源:TinyLogger.java


示例18: testWrite

import org.pmw.tinylog.Level; //导入依赖的package包/类
@Test
public void testWrite() throws Exception {
    final GelfTransport client = mock(GelfTransport.class);
    final GelfWriter gelfWriter = new GelfWriter("localhost", 12201, GelfTransports.UDP, "myHostName",
            EnumSet.of(LogEntryValue.EXCEPTION, LogEntryValue.PROCESS_ID),
            Collections.<String, Object>singletonMap("staticField", "TEST"), 512, 1000, 500, -1, false);

    @SuppressWarnings("all")
    final RuntimeException exception = new RuntimeException("BOOM!");
    exception.fillInStackTrace();
    final Date now = new Date();
    final ThreadGroup threadGroup = new ThreadGroup("TEST-threadGroup");
    final Thread thread = new Thread(threadGroup, "TEST-thread");
    thread.setPriority(1);

    final LogEntry logEntry = new LogEntry(now, "TEST-processId", thread,
            "TEST-ClassName", "TEST-MethodName", "TEST-FileName", 42, Level.INFO,
            "Test 123", exception);

    gelfWriter.write(client, logEntry);

    final ArgumentCaptor<GelfMessage> argumentCaptor = ArgumentCaptor.forClass(GelfMessage.class);
    verify(client).send(argumentCaptor.capture());

    final GelfMessage message = argumentCaptor.getValue();
    assertThat(message.getHost(), equalTo("myHostName"));
    assertThat(message.getMessage(), equalTo("Test 123"));
    assertThat(message.getLevel(), equalTo(GelfMessageLevel.INFO));
    assertThat(new Date((long) (message.getTimestamp() * 1000l)), equalTo(now));
    assertThat(message.getFullMessage(), startsWith(message.getMessage()));

    final Map<String, Object> additionalFields = message.getAdditionalFields();
    assertThat(additionalFields.isEmpty(), is(false));
    assertThat((String) additionalFields.get("processId"), equalTo("TEST-processId"));
    assertThat((String) additionalFields.get("threadName"), equalTo("TEST-thread"));
    assertThat((Integer) additionalFields.get("threadPriority"), equalTo(1));
    assertThat((String) additionalFields.get("threadGroup"), equalTo("TEST-threadGroup"));
    assertThat((String) additionalFields.get("sourceClassName"), equalTo("TEST-ClassName"));
    assertThat((String) additionalFields.get("sourceMethodName"), equalTo("TEST-MethodName"));
    assertThat((String) additionalFields.get("sourceFileName"), equalTo("TEST-FileName"));
    assertThat((Integer) additionalFields.get("sourceLineNumber"), equalTo(42));
    assertThat((String) additionalFields.get("exceptionMessage"), equalTo("BOOM!"));
    assertThat((String) additionalFields.get("exceptionClass"), equalTo(RuntimeException.class.getCanonicalName()));
    assertThat((String) additionalFields.get("exceptionStackTrace"), startsWith(this.getClass().getCanonicalName()));
}
 
开发者ID:joschi,项目名称:tinylog-gelf,代码行数:46,代码来源:GelfWriterTest.java



注:本文中的org.pmw.tinylog.Level类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ImplicitObjectELResolver类代码示例发布时间:2022-05-22
下一篇:
Java RangeException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap