⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 logtest.java

📁 一个java工作流引擎
💻 JAVA
字号:
package org.jbpm.util.log;

import java.io.*;
import java.util.*;
import org.apache.commons.logging.*;
import junit.framework.*;

public class LogTest extends TestCase {

  public LogTest(String name) {
    super(name);
  }

  public void testProgrammaticConfiguration() {
    org.jbpm.util.log.JbpmLogFactory.setDefaultLevel( Level.ERROR );
    org.jbpm.util.log.JbpmLogFactory.setLevel( "org.jbpm", Level.TRACE );
    
    Log log = LogFactory.getLog( LogTest.class );
    log.info( "testing the programmatic configuration..." );
    log.info( "log.class " + log.getClass().getName() );

    log.trace( "trace message" );
    log.debug( "debug message" );
    log.info( "info message" );
    log.warn( "warn message" );
    log.error( "error message" );
    log.fatal( "fatal message" );

    LogFactory.getFactory().setAttribute( "level.org.jbpm", Level.ERROR );

    log.trace( "trace message" );
    log.debug( "debug message" );
    log.info( "info message" );
    log.warn( "warn message" );
    log.error( "error message" );
    log.fatal( "fatal message" );
  }

  public void testPropertiesFileConfiguration() throws Exception {  
    Properties properties = new Properties();
    InputStream is = LogTest.class.getClassLoader().getResourceAsStream("org/jbpm/util/log/log.properties");
    properties.load( is );
    org.jbpm.util.log.JbpmLogFactory.initJbpmLogging( properties );

    Log log = LogFactory.getLog( LogTest.class );
    log.info( "testing file configuration..." );
    log.trace( "trace message" );
    log.debug( "debug message" );
    log.info( "info message" );
    log.warn( "warn message" );
    log.error( "error message" );
    log.fatal( "fatal message" );
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -