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


Java SimpleLogger类代码示例

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

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


示例16: startBundle

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
@Override
public void startBundle(Context c) throws Exception {
  logger = (SimpleLogger) new SimpleLoggerFactory().getLogger(this.className);
}
 
开发者ID:fhoffa,项目名称:bqpipeline,代码行数:5,代码来源:LogElements.java


示例17: setLogLevel

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
private static void setLogLevel(String prefix, String level) {
    System.setProperty(SimpleLogger.LOG_KEY_PREFIX + prefix, level);
}
 
开发者ID:nidi3,项目名称:raml-tester-proxy,代码行数:4,代码来源:LogConfigurer.java


示例18: main

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
public static void main(String[] args) {
    System.setProperty(SimpleLogger.SHOW_DATE_TIME_KEY, "true");
    System.setProperty(SimpleLogger.DATE_TIME_FORMAT_KEY, "[HH:mm:ss]");
    System.setProperty(SimpleLogger.SHOW_THREAD_NAME_KEY, "false");
    System.setProperty(SimpleLogger.LEVEL_IN_BRACKETS_KEY, "true");
    System.setProperty(SimpleLogger.SHOW_LOG_NAME_KEY, "false");
    System.out.println("Starting");
    try {
        startup = System.currentTimeMillis();
        final Config config = new Config();
        PermissionManager manager = new PermissionManager();
        System.out.println("Loading and registering commands");
        config.load();
        manager.load();
        Reflections reflections = new Reflections("com.zack6849.alphabot.commands");
        Set<Class<? extends Command>> subTypes = reflections.getSubTypesOf(Command.class);
        for (Class c : subTypes) {
            Command cmd = CommandRegistry.getCommand(c.getSimpleName());
            cmd.setManager(manager);
            cmd.setConfig(config);
            CommandRegistry.register(cmd);
        }
        //i have no idea what this is, but IDEA wouldn't shut the fuck up about changing it.
        Configuration.Builder<PircBotX> builder = new Configuration.Builder<PircBotX>();
        builder.setName(config.getBotNickname());
        builder.setRealName(config.getBotUsername());
        builder.setLogin(config.getBotIdent());
        builder.setFinger(config.getCtcpFinger());
        builder.setEncoding(Charset.isSupported("UTF-8") ? Charset.forName("UTF-8") : Charset.defaultCharset());
        builder.setNickservPassword(config.getBotPassword());
        builder.setVersion("Alphbot v2.0 BETA");
        builder.setAutoNickChange(config.isAutoNickChange());
        builder.setAutoReconnect(config.isAutoReconnectServer());
        builder.setServer(config.getServerHostame(), Integer.parseInt(config.getServerPort()), config.getServerPassword());
        builder.getListenerManager().addListener(new com.zack6849.alphabot.listeners.MessageEvent(config, manager));
        builder.getListenerManager().addListener(new com.zack6849.alphabot.listeners.InviteEvent(config, manager));
        for (String channel : config.getChannels()) {
            builder.addAutoJoinChannel(channel);
        }
        PircBotX bot = new PircBotX(builder.buildConfiguration());
        System.out.println("Starting bot...");
        if (config.isEnableChatSocket()) {
            new Thread(new ChatSocketListener(bot, config)).start();
        }
        bot.startBot();
        System.out.println("Shutting down");
        System.exit(0);
    } catch (Exception ex) {
        ex.printStackTrace();
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:zack6849,项目名称:AlphabotV2,代码行数:53,代码来源:Main.java


示例19: main

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    config = new Config();
    config.load();

    registerCommands();

    //Setup Logger
    System.setProperty(SimpleLogger.SHOW_DATE_TIME_KEY, "true");
    System.setProperty(SimpleLogger.DATE_TIME_FORMAT_KEY, "[HH:mm:ss]");
    System.setProperty(SimpleLogger.SHOW_THREAD_NAME_KEY, "false");
    System.setProperty(SimpleLogger.LEVEL_IN_BRACKETS_KEY, "true");
    System.setProperty(SimpleLogger.SHOW_LOG_NAME_KEY, "true");
    System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "debug");
    Logger logger = new SimpleLoggerFactory().getLogger(Main.class.getName());
    System.out.println(logger.isDebugEnabled());

    //Setup this bot
    Configuration.Builder builder = new Configuration.Builder();
    builder.setName(config.getBotNickname());
    builder.setRealName(config.getBotRealname());
    builder.setLogin(config.getBotLogin());
    //builder.setNickservPassword(config.getBotPassword());
    builder.setAutoNickChange(true);
    builder.addListener(new BotListener());
    builder.setServer(config.getServerHostname(), config.getServerPort(), config.getServerPassword());
    builder.setSocketFactory(new UtilSSLSocketFactory().trustAllCertificates());
    for(String channel : config.getChannels()){
        builder.addAutoJoinChannel(channel);
    }
    PircBotX bot = new PircBotX(builder.buildConfiguration());

    minecraftLog = new LogTailer(bot, "/home/minecraft/1.7.2/logs/latest.log");
    //Connect to server
    try {
        logger.debug("staring bot");
        bot.startBot();
    } catch (Exception ex) {
        logger.error(null, ex);
        ex.printStackTrace();
    }
}
 
开发者ID:mimiKitsune,项目名称:MimiBot,代码行数:42,代码来源:Main.java


示例20: init

import org.slf4j.impl.SimpleLogger; //导入依赖的package包/类
@Override
public void init() {
    super.init();

    System.setProperty(SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "TRACE");

    uploadFolder = Files.createTempDir();
    baseFolder = Files.createTempDir();

    nameSequence = new AtomicInteger(1);

    converter = loadConverter();
}
 
开发者ID:documents4j,项目名称:documents4j,代码行数:14,代码来源:DemoApplication.java



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