jodd.log.Logger.isInfoEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(336)

本文整理了Java中jodd.log.Logger.isInfoEnabled()方法的一些代码示例,展示了Logger.isInfoEnabled()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.isInfoEnabled()方法的具体详情如下:
包路径:jodd.log.Logger
类名称:Logger
方法名:isInfoEnabled

Logger.isInfoEnabled介绍

[英]Returns true if INFO level is enabled.
[中]如果启用了信息级别,则返回true

代码示例

代码示例来源:origin: oblac/jodd

  1. /**
  2. * Logs a message at INFO level.
  3. */
  4. default void info(final Supplier<String> messageSupplier) {
  5. if (isInfoEnabled()) {
  6. info(messageSupplier.get());
  7. }
  8. }

代码示例来源:origin: oblac/jodd

  1. /**
  2. * Close all the connections. Use with caution: be sure no connections are in
  3. * use before calling. Note that you are not <i>required</i> to call this
  4. * when done with a ConnectionPool, since connections are guaranteed to be
  5. * closed when garbage collected. But this method gives more control
  6. * regarding when the connections are closed.
  7. */
  8. @Override
  9. public synchronized void close() {
  10. if (log.isInfoEnabled()) {
  11. log.info("Core connection pool shutdown");
  12. }
  13. closeConnections(availableConnections);
  14. availableConnections = new ArrayList<>(maxConnections);
  15. closeConnections(busyConnections);
  16. busyConnections = new ArrayList<>(maxConnections);
  17. }

代码示例来源:origin: oblac/jodd

  1. /**
  2. * Checks if connection provider can return a connection.
  3. */
  4. protected void checkConnectionProvider() {
  5. final Connection connection = connectionProvider.getConnection();
  6. try {
  7. final DatabaseMetaData databaseMetaData = connection.getMetaData();
  8. String name = databaseMetaData.getDatabaseProductName();
  9. String version = databaseMetaData.getDatabaseProductVersion();
  10. if (log.isInfoEnabled()) {
  11. log.info("Connected to database: " + name + " v" + version);
  12. }
  13. } catch (SQLException sex) {
  14. log.error("DB connection failed: ", sex);
  15. } finally {
  16. connectionProvider.closeConnection(connection);
  17. }
  18. }

代码示例来源:origin: oblac/jodd

  1. return;
  2. if (log.isInfoEnabled()) {
  3. log.info("Core connection pool initialization");

代码示例来源:origin: oblac/jodd

  1. /**
  2. * Clears all settings and removes all created bundle files from file system.
  3. */
  4. public synchronized void reset() {
  5. if (strategy == Strategy.ACTION_MANAGED) {
  6. actionBundles.clear();
  7. mirrors.clear();
  8. }
  9. FindFile ff = new FindFile();
  10. ff.includeDirs(false);
  11. ff.searchPath(new File(bundleFolder, staplerPath));
  12. File f;
  13. int count = 0;
  14. while ((f = ff.nextFile()) != null) {
  15. f.delete();
  16. count++;
  17. }
  18. if (log.isInfoEnabled()) {
  19. log.info("reset: " + count + " bundle files deleted.");
  20. }
  21. }

代码示例来源:origin: oblac/jodd

  1. /**
  2. * Loads Madvoc parameters. New {@link Props} is created from the classpath.
  3. */
  4. protected Props loadMadvocParams(final String[] patterns) {
  5. if (log.isInfoEnabled()) {
  6. log.info("Loading Madvoc parameters from: " + Converter.get().toString(patterns));
  7. }
  8. try {
  9. return new Props().loadFromClasspath(patterns);
  10. } catch (Exception ex) {
  11. throw new MadvocException("Unable to load Madvoc parameters from: " +
  12. Converter.get().toString(patterns) + ".properties': " + ex.toString(), ex);
  13. }
  14. }

代码示例来源:origin: oblac/jodd

  1. /**
  2. * Configures {@link DbEntityManager} with specified class path.
  3. */
  4. public void configure() {
  5. long elapsed = System.currentTimeMillis();
  6. final ClassScanner classScanner = new ClassScanner();
  7. classScanner.detectEntriesMode(true);
  8. classScanner.scanDefaultClasspath();
  9. classScannerConsumers.accept(classScanner);
  10. registerAsConsumer(classScanner);
  11. try {
  12. classScanner.start();
  13. } catch (Exception ex) {
  14. throw new DbOomException("Scan classpath error", ex);
  15. }
  16. elapsed = System.currentTimeMillis() - elapsed;
  17. if (log.isInfoEnabled()) {
  18. log.info("DbEntityManager configured in " + elapsed + "ms. Total entities: " + dbEntityManager.getTotalNames());
  19. }
  20. }

代码示例来源:origin: oblac/jodd

  1. if (log.isInfoEnabled()) {
  2. log.info("Bundle created: " + bundleId);

代码示例来源:origin: oblac/jodd

  1. @Test
  2. void testIsLevelEnabled() {
  3. // Loggers does not provide any API to enable levels.
  4. // Instead we need to use log/level(trace/debug etc) API to log information into corresponding level
  5. assertFalse(logger.isTraceEnabled());
  6. assertFalse(logger.isDebugEnabled());
  7. assertFalse(logger.isInfoEnabled());
  8. assertFalse(logger.isWarnEnabled());
  9. assertFalse(logger.isErrorEnabled());
  10. }

代码示例来源:origin: oblac/jodd

  1. @Override
  2. @Test
  3. void testIsLevelEnabled() {
  4. //when
  5. initializeLogFactoryAndLogger(Logger.Level.DEBUG);
  6. //then
  7. assertTrue(logger.isDebugEnabled());
  8. //when
  9. initializeLogFactoryAndLogger(Logger.Level.ERROR);
  10. //then
  11. assertTrue(logger.isErrorEnabled());
  12. //when
  13. initializeLogFactoryAndLogger(Logger.Level.INFO);
  14. //then
  15. assertTrue(logger.isInfoEnabled());
  16. //when
  17. initializeLogFactoryAndLogger(Logger.Level.TRACE);
  18. //then
  19. assertTrue(logger.isTraceEnabled());
  20. //when
  21. initializeLogFactoryAndLogger(Logger.Level.WARN);
  22. //then
  23. assertTrue(logger.isWarnEnabled());
  24. }

代码示例来源:origin: org.jodd/jodd-log

  1. /**
  2. * Logs a message at INFO level.
  3. */
  4. default void info(final Supplier<String> messageSupplier) {
  5. if (isInfoEnabled()) {
  6. info(messageSupplier.get());
  7. }
  8. }

代码示例来源:origin: org.jodd/jodd-db

  1. /**
  2. * Close all the connections. Use with caution: be sure no connections are in
  3. * use before calling. Note that you are not <i>required</i> to call this
  4. * when done with a ConnectionPool, since connections are guaranteed to be
  5. * closed when garbage collected. But this method gives more control
  6. * regarding when the connections are closed.
  7. */
  8. @Override
  9. public synchronized void close() {
  10. if (log.isInfoEnabled()) {
  11. log.info("Core connection pool shutdown");
  12. }
  13. closeConnections(availableConnections);
  14. availableConnections = new ArrayList<>(maxConnections);
  15. closeConnections(busyConnections);
  16. busyConnections = new ArrayList<>(maxConnections);
  17. }

代码示例来源:origin: org.jodd/jodd-joy

  1. /**
  2. * Checks if connection provider can return a connection.
  3. */
  4. protected void checkConnectionProvider() {
  5. final Connection connection = connectionProvider.getConnection();
  6. try {
  7. final DatabaseMetaData databaseMetaData = connection.getMetaData();
  8. String name = databaseMetaData.getDatabaseProductName();
  9. String version = databaseMetaData.getDatabaseProductVersion();
  10. if (log.isInfoEnabled()) {
  11. log.info("Connected to database: " + name + " v" + version);
  12. }
  13. } catch (SQLException sex) {
  14. log.error("DB connection failed: ", sex);
  15. } finally {
  16. connectionProvider.closeConnection(connection);
  17. }
  18. }

代码示例来源:origin: org.jodd/jodd-db

  1. return;
  2. if (log.isInfoEnabled()) {
  3. log.info("Core connection pool initialization");

代码示例来源:origin: org.jodd/jodd-htmlstapler

  1. /**
  2. * Clears all settings and removes all created bundle files from file system.
  3. */
  4. public synchronized void reset() {
  5. if (strategy == Strategy.ACTION_MANAGED) {
  6. actionBundles.clear();
  7. mirrors.clear();
  8. }
  9. FindFile ff = new FindFile();
  10. ff.includeDirs(false);
  11. ff.searchPath(new File(bundleFolder, staplerPath));
  12. File f;
  13. int count = 0;
  14. while ((f = ff.nextFile()) != null) {
  15. f.delete();
  16. count++;
  17. }
  18. if (log.isInfoEnabled()) {
  19. log.info("reset: " + count + " bundle files deleted.");
  20. }
  21. }

代码示例来源:origin: org.jodd/jodd-db

  1. /**
  2. * Configures {@link DbEntityManager} with specified class path.
  3. */
  4. public void configure() {
  5. long elapsed = System.currentTimeMillis();
  6. final ClassScanner classScanner = new ClassScanner();
  7. classScanner.detectEntriesMode(true);
  8. classScanner.scanDefaultClasspath();
  9. classScannerConsumers.accept(classScanner);
  10. registerAsConsumer(classScanner);
  11. try {
  12. classScanner.start();
  13. } catch (Exception ex) {
  14. throw new DbOomException("Scan classpath error", ex);
  15. }
  16. elapsed = System.currentTimeMillis() - elapsed;
  17. if (log.isInfoEnabled()) {
  18. log.info("DbEntityManager configured in " + elapsed + "ms. Total entities: " + dbEntityManager.getTotalNames());
  19. }
  20. }

代码示例来源:origin: org.jodd/jodd-htmlstapler

  1. if (log.isInfoEnabled()) {
  2. log.info("Bundle created: " + bundleId);

相关文章