当前位置: 首页>>代码示例>>Java>>正文


Java SimpleLogger类代码示例

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


SimpleLogger类属于org.slf4j.impl包,在下文中一共展示了SimpleLogger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addConsoleDebug

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
/**
 * Adds a little (not complete) console debug output to a mocked logger.
 *
 * @param mogger
 *            the mocked logger
 */
public static void addConsoleDebug(SimpleLogger mogger) {
    Answer<Void> answer = new Answer<Void>() {
        @Override
        public Void answer(InvocationOnMock invocation) throws Throwable {
            Object[] arguments = invocation.getArguments();
            if (arguments != null && arguments.length > 0
                    && arguments[0] != null) {
                System.out.println(arguments[0]);
            }
            return null;
        }
    };
    Mockito.doAnswer(answer).when(mogger).debug(Matchers.anyString());
    Mockito.doAnswer(answer).when(mogger).debug(Matchers.anyString(),
            Matchers.any(Throwable.class));
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:23,代码来源:LoggerMocking.java

示例2: install

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
public static void install()
{
  setDefaultProperty(SimpleLogger.SHOW_THREAD_NAME_KEY, Boolean.FALSE.toString());
  setDefaultProperty(SimpleLogger.LEVEL_IN_BRACKETS_KEY, Boolean.TRUE.toString());
  setDefaultProperty(SimpleLogger.SHOW_LOG_NAME_KEY, Boolean.FALSE.toString());
  
  // apply Maven log level to well known white-listed ivy loggers
  String mavenClientLogLevel = getDefaultLogLevel();
  for(String loggerName : INTERESTING_LOGGERS)
  {
    System.setProperty(SimpleLogger.LOG_KEY_PREFIX+loggerName, mavenClientLogLevel);
  }
  
  // only log errors from unspecific engine loggers! 
  System.setProperty(SimpleLogger.LOG_KEY_PREFIX+IVY_PREFIX, Level.ERROR);

  //Disable CXF warning at startup (missing META-INF/cxf/cxf.xml)
  System.setProperty(SimpleLogger.LOG_KEY_PREFIX+"org.apache.cxf.bus.spring", Level.ERROR);
  
  // only warnings from any logger used by ivy third parties (e.g. org.apache.myfaces.xxx, org.apache.cxf, ...)
  System.setProperty(DEFAULT_LOG_LEVEL, Level.WARNING);
}
 
开发者ID:axonivy,项目名称:project-build-plugin,代码行数:23,代码来源:Slf4jSimpleEngineProperties.java

示例3: beforeAllTest

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
@BeforeClass
public static void beforeAllTest() throws Exception {
    System.out.flush();
    out = TeeInMemoryStringPrintStream.teeTo(System.out);
    System.setOut(out);

    System.err.flush();
    err = TeeInMemoryStringPrintStream.teeTo(System.err);
    System.setErr(err);

    simpleLoggerOutField = SimpleLogger.class.getDeclaredField("TARGET_STREAM");
    simpleLoggerOutField.setAccessible(true);
    simpleLoggerPrintStream = (PrintStream) simpleLoggerOutField.get(null);
    simpleLoggerPrintStream.flush();
    simpleLoggerOutField.set(null, err); // Using the default configuration, SimpleLogger will use the err. Either way, we are going to reset to the original value after this set of tests
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:17,代码来源:LightblueAuditServletFilterTest.java

示例4: starting

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
@Override
public void starting(Description description) {
    if (FirebaseApp.getApps().isEmpty()) {
        final GoogleCredentials credentials;

        try {
            credentials = GoogleCredentials.fromStream(new FileInputStream(SERVICE_ACCOUNT_CREDENTIALS));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        FirebaseOptions firebaseOptions = new FirebaseOptions.Builder()
                .setDatabaseUrl(databaseUrl)
                .setCredentials(credentials)
                .build();
        FirebaseApp.initializeApp(firebaseOptions);

        System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "DEBUG");
    }
    this.databaseReference = FirebaseDatabase.getInstance().getReferenceFromUrl(databaseUrl);
}
 
开发者ID:firebase,项目名称:geofire-java,代码行数:22,代码来源:GeoFireTestingRule.java

示例5: init

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
/** Performs App init, called only once by VisEditor. */
static void init () {
	if (initialized) throw new IllegalStateException("App cannot be initialized twice!");
	new File(APP_FOLDER_PATH).mkdir();

	Log.init();
	//com.esotericsoftware.minlog.Log.TRACE();
	System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "ERROR");

	checkCharset();

	try {
		buildTimestamp = readTimestamp();
		if (buildTimestamp == null || buildTimestamp.equals("not built using CI")) {
			buildTimestamp = "not built using CI";
			buildTimestampValid = false;
		} else
			buildTimestampValid = true;
	} catch (IOException e) {
		Log.exception(e);
	}

	Log.info("Build: " + App.buildTimestamp);
	initialized = true;
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:26,代码来源:App.java

示例6: main

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    System.err.println("\nWelcome to WaveTact!\n");

    System.setProperty(SimpleLogger.SHOW_DATE_TIME_KEY, "true");
    System.setProperty(SimpleLogger.DATE_TIME_FORMAT_KEY, "[yyyy/MM/dd HH:mm:ss]");
    System.setProperty(SimpleLogger.LEVEL_IN_BRACKETS_KEY, "true");
    if(args.length == 1 && args[0].equalsIgnoreCase("--windowsdev")){
        load(true);
    }else{
        if ((args.length >= 1) && args[0].equalsIgnoreCase("--client")) {
            ConsoleClient.go();
        } else if (new File("./console.unixsocket").exists()) {
            System.err.println("Instance already started");
            System.exit(0);
        } else {
            load(false);
        }
    }
}
 
开发者ID:TechCavern,项目名称:WaveTact,代码行数:20,代码来源:Main.java

示例7: setupLogging

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
private void setupLogging() {
    if (verbosityLevel <= 0) {
        // Verbosity is INFO or OFF, we hide the thread and logger names
        System.setProperty(SimpleLogger.SHOW_THREAD_NAME_KEY, "false");
        System.setProperty(SimpleLogger.SHOW_LOG_NAME_KEY, "false");
    }

    String level;
    switch (verbosityLevel) {
        case -1:
            level = "OFF";
            break;
        case 1:
            level = "DEBUG";
            break;
        case 2:
            level = "TRACE";
            break;
        default:
            level = "INFO";
            break;
    }

    System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, level);

    LOGGER = LoggerFactory.getLogger(Main.class);
    LOGGER.debug("Log Level: {}", level);
}
 
开发者ID:docbleach,项目名称:DocBleach,代码行数:29,代码来源:Main.java

示例8: main

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
public static void main(String[] args) {
    System.setProperty(SimpleLogger.ROOT_LOGGER_NAME, "PocketServer");
    System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "debug");
    System.setProperty(SimpleLogger.LEVEL_IN_BRACKETS_KEY, "true");
    System.setProperty(SimpleLogger.SHOW_THREAD_NAME_KEY, "false");
    System.setProperty(SimpleLogger.SHOW_DATE_TIME_KEY, "false");

    PocketServer server = new PocketServer();
    while (true) {

    }
}
 
开发者ID:PocketServer,项目名称:PocketServer,代码行数:13,代码来源:PocketBootstrap.java

示例9: setSlf4jTargetStream

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
public static void setSlf4jTargetStream(Class<?> clazz, PrintStream stream)
{
   SimpleLogger simpleLogger = (SimpleLogger) LoggerFactory.getLogger(clazz);
   try {
      Field field = clazz.getClassLoader().loadClass("org.slf4j.impl.SimpleLogger").getDeclaredField("TARGET_STREAM");
      field.setAccessible(true);
      field.set(simpleLogger, stream);
   }
   catch (Exception e) {
      throw new RuntimeException(e);
   }
}
 
开发者ID:openbouquet,项目名称:HikariCP,代码行数:13,代码来源:TestElf.java

示例10: setSlf4jLogLevel

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
public static void setSlf4jLogLevel(Class<?> clazz, int logLevel)
{
   SimpleLogger simpleLogger = (SimpleLogger) LoggerFactory.getLogger(clazz);
   try {
      Field field = clazz.getClassLoader().loadClass("org.slf4j.impl.SimpleLogger").getDeclaredField("currentLogLevel");
      field.setAccessible(true);
      field.setInt(simpleLogger, logLevel);
   }
   catch (Exception e) {
      throw new RuntimeException(e);
   }
}
 
开发者ID:openbouquet,项目名称:HikariCP,代码行数:13,代码来源:TestElf.java

示例11: reset

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
public static void reset()
{
  for(String loggerName : INTERESTING_LOGGERS)
  {
    System.clearProperty(SimpleLogger.LOG_KEY_PREFIX+loggerName);
  }
  System.clearProperty(SimpleLogger.LOG_KEY_PREFIX+IVY_PREFIX);
}
 
开发者ID:axonivy,项目名称:project-build-plugin,代码行数:9,代码来源:Slf4jSimpleEngineProperties.java

示例12: mainInternal

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
protected static int mainInternal(String... args) {
	CommandMain mainCommand = new CommandMain();
	CommandPomMergeDriver mergeCommand = new CommandPomMergeDriver();
	CommandPomVersionReplacer versionReplacerCommand = new CommandPomVersionReplacer();

	JCommander jc = new JCommander(mainCommand);
	jc.addCommand("merge", mergeCommand);
	jc.addCommand("replace", versionReplacerCommand);

	try {
		jc.parse(args);
	} catch (ParameterException e) {
		System.err.println(e.getMessage());
		return 1;
	}

	String logLevel = mainCommand.isDebug() ? "debug" : "error";
	System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, logLevel);

	logger = LoggerFactory.getLogger(Main.class);

	if (logger.isInfoEnabled()) {
		logger.info("PomUtils version {}", ManifestUtils.getImplementationVersion());
	}

	if ("merge".equals(jc.getParsedCommand())) {
		return executePomMergeDriver(mergeCommand);
	} else if ("replace".equals(jc.getParsedCommand())) {
		executePomVersionReplacer(versionReplacerCommand);
		return 0;
	}
	jc.usage();
	return 1;
}
 
开发者ID:cecom,项目名称:pomutils,代码行数:35,代码来源:Main.java

示例13: config

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
public static void config() {
    System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, DEBUG);
    setLogLevel("org.eclipse.jetty", WARN);
    setLogLevel("org.raml.parser", WARN);
    setLogLevel("org.apache.http", WARN);
    setLogLevel("guru.nidi.ramlproxy.jetty.JettyProxyServlet", INFO);
    LoggerFactory.getILoggerFactory();
}
 
开发者ID:nidi3,项目名称:raml-tester-proxy,代码行数:9,代码来源:LogConfigurer.java

示例14: before

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
@Before
public void before()
{
	System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "TRACE");
}
 
开发者ID:runelite,项目名称:runelite,代码行数:6,代码来源:CacheClientTest.java

示例15: setUpClass

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
@BeforeClass
public static void setUpClass(){
    System.setProperty(SimpleLogger.LOG_FILE_KEY, "System.err");
}
 
开发者ID:azige,项目名称:moebooru-viewer,代码行数:5,代码来源:MoebooruAPITest.java


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