org.slf4j.helpers.NOPLogger Java Examples
The following examples show how to use
org.slf4j.helpers.NOPLogger.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VirtualChestRecordManager.java From VirtualChest with GNU Lesser General Public License v3.0 | 6 votes |
public void init() { this.sql = Sponge.getServiceManager().provideUnchecked(SqlService.class); try // TODO: the logger is annoying, so disable it anyway (although it is a dirty way) { Field field = DB.class.getDeclaredField("LOGGER"); field.setAccessible(true); Field modifiersField = Field.class.getDeclaredField("modifiers"); int m = field.getModifiers() & ~Modifier.FINAL; modifiersField.setAccessible(true); modifiersField.setInt(field, m); NOPLogger l = NOPLogger.NOP_LOGGER; field.set(null, l); } catch (ReflectiveOperationException e) { throw new IllegalStateException(e); } }
Example #2
Source File: HiveClientImpl.java From dremio-oss with Apache License 2.0 | 6 votes |
@Override public Table getTable(final String dbName, final String tableName, boolean ignoreAuthzErrors) throws TException{ Table table = getTableWithoutTableTypeChecking(dbName, tableName, ignoreAuthzErrors); if(table == null){ return null; } TableType type = TableType.valueOf(table.getTableType()); switch (type) { case EXTERNAL_TABLE: case MANAGED_TABLE: return table; case VIRTUAL_VIEW: throw UserException.unsupportedError().message("Hive views are not supported").build(NOPLogger.NOP_LOGGER); case INDEX_TABLE: default: return null; } }
Example #3
Source File: HiveClientImpl.java From dremio-oss with Apache License 2.0 | 6 votes |
@Override public Table getTable(final String dbName, final String tableName, boolean ignoreAuthzErrors) throws TException{ Table table = getTableWithoutTableTypeChecking(dbName, tableName, ignoreAuthzErrors); if(table == null){ return null; } TableType type = TableType.valueOf(table.getTableType()); switch (type) { case EXTERNAL_TABLE: case MANAGED_TABLE: return table; case VIRTUAL_VIEW: throw UserException.unsupportedError().message("Hive views are not supported").build(NOPLogger.NOP_LOGGER); default: return null; } }
Example #4
Source File: SingularityExecutorThreadChecker.java From Singularity with Apache License 2.0 | 6 votes |
private Optional<Integer> getNumThreadsFromCommand( SingularityExecutorTaskProcessCallable taskProcess, Optional<Integer> dockerPid, String commandFormat ) throws InterruptedException, ProcessFailedException { SimpleProcessManager checkThreadsProcessManager = new SimpleProcessManager( NOPLogger.NOP_LOGGER ); List<String> cmd = ImmutableList.of( "/bin/sh", "-c", String.format(commandFormat, dockerPid.orElse(taskProcess.getCurrentPid().get())) ); List<String> output = checkThreadsProcessManager.runCommandWithOutput(cmd); if (output.isEmpty()) { LOG.warn("Output from ls was empty ({})", cmd); return Optional.empty(); } else { return Optional.of(Integer.parseInt(output.get(0))); } }
Example #5
Source File: RestServerEndpointTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testCreateUploadDir() throws Exception { final File file = temporaryFolder.newFolder(); final Path testUploadDir = file.toPath().resolve("testUploadDir"); assertFalse(Files.exists(testUploadDir)); RestServerEndpoint.createUploadDir(testUploadDir, NOPLogger.NOP_LOGGER); assertTrue(Files.exists(testUploadDir)); }
Example #6
Source File: RestServerEndpointTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testCreateUploadDirFails() throws Exception { final File file = temporaryFolder.newFolder(); Assume.assumeTrue(file.setWritable(false)); final Path testUploadDir = file.toPath().resolve("testUploadDir"); assertFalse(Files.exists(testUploadDir)); try { RestServerEndpoint.createUploadDir(testUploadDir, NOPLogger.NOP_LOGGER); fail("Expected exception not thrown."); } catch (IOException e) { } }
Example #7
Source File: RestServerEndpointTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testCreateUploadDir() throws Exception { final File file = temporaryFolder.newFolder(); final Path testUploadDir = file.toPath().resolve("testUploadDir"); assertFalse(Files.exists(testUploadDir)); RestServerEndpoint.createUploadDir(testUploadDir, NOPLogger.NOP_LOGGER, true); assertTrue(Files.exists(testUploadDir)); }
Example #8
Source File: RestServerEndpointTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testCreateUploadDirFails() throws Exception { final File file = temporaryFolder.newFolder(); Assume.assumeTrue(file.setWritable(false)); final Path testUploadDir = file.toPath().resolve("testUploadDir"); assertFalse(Files.exists(testUploadDir)); try { RestServerEndpoint.createUploadDir(testUploadDir, NOPLogger.NOP_LOGGER, true); fail("Expected exception not thrown."); } catch (IOException e) { } }
Example #9
Source File: CasLoggerFactory.java From springboot-shiro-cas-mybatis with MIT License | 5 votes |
/** * {@inheritDoc} * <p>Attempts to find the <strong>real</strong> <code>Logger</code> instance that * is doing the heavy lifting and routes the request to an instance of * {@link CasDelegatingLogger}. The instance is cached by the logger name.</p> */ @Override public Logger getLogger(final String name) { if (StringUtils.isBlank(name)) { return NOPLogger.NOP_LOGGER; } synchronized (loggerMap) { if (!loggerMap.containsKey(name)) { final Logger logger = getRealLoggerInstance(name); loggerMap.put(name, new CasDelegatingLogger(logger)); } return loggerMap.get(name); } }
Example #10
Source File: Slf4jTimeLogger.java From onetwo with Apache License 2.0 | 5 votes |
@Override public void log(Class<?> logSource, String msg, Object...args){ Logger logger = this.logger; if(logger==null || NOPLogger.class.isInstance(logger)){ logger = JFishLoggerFactory.getLogger(logSource); } logger.info("\n"+msg, args); }
Example #11
Source File: TimeCounter.java From onetwo with Apache License 2.0 | 5 votes |
protected TimeLogger getTimeLogger(){ TimeLogger logger = this.timeLogger; if(logger==null){ Slf4jTimeLogger slf4j = new Slf4jTimeLogger(); if(slf4j.getLogger() instanceof NOPLogger){ logger = new TimerOutputer(); }else{ logger = slf4j; } this.timeLogger = logger; } return logger; }
Example #12
Source File: JFishLoggerFactory.java From onetwo with Apache License 2.0 | 5 votes |
public static Logger findMailLogger(){ Logger logger = mailLogger; if (logger == null) { logger = findLogger(MAIL_LOGGER); if (logger == null) { logger = NOPLogger.NOP_LOGGER; } mailLogger = logger; } return logger; }
Example #13
Source File: RestServerEndpointTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testCreateUploadDir() throws Exception { final File file = temporaryFolder.newFolder(); final Path testUploadDir = file.toPath().resolve("testUploadDir"); assertFalse(Files.exists(testUploadDir)); RestServerEndpoint.createUploadDir(testUploadDir, NOPLogger.NOP_LOGGER, true); assertTrue(Files.exists(testUploadDir)); }
Example #14
Source File: RestServerEndpointTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testCreateUploadDirFails() throws Exception { final File file = temporaryFolder.newFolder(); Assume.assumeTrue(file.setWritable(false)); final Path testUploadDir = file.toPath().resolve("testUploadDir"); assertFalse(Files.exists(testUploadDir)); try { RestServerEndpoint.createUploadDir(testUploadDir, NOPLogger.NOP_LOGGER, true); fail("Expected exception not thrown."); } catch (IOException e) { } }
Example #15
Source File: LookoutLoggerFactoryTest.java From sofa-lookout with Apache License 2.0 | 4 votes |
@Test public void testLookoutLoggerFactory() { Logger logger = LookoutLoggerFactory.getLogger(LookoutLoggerFactoryTest.class); Assert.assertTrue(logger instanceof NOPLogger); }
Example #16
Source File: JFishLoggerFactory.java From onetwo with Apache License 2.0 | 4 votes |
public static Logger findErrorLogger(){ return findErrorLogger(NOPLogger.NOP_LOGGER); }