freemarker.log.Logger.logWarnInLogger()方法的使用及代码示例

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

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

Logger.logWarnInLogger介绍

暂无

代码示例

代码示例来源:origin: org.freemarker/freemarker

  1. /**
  2. * Don't use {@link freemarker.template.utility.SecurityUtilities#getSystemProperty(String, String)} here, as it
  3. * (might) depends on the logger, hence interfering with the initialization.
  4. */
  5. private static String getSystemProperty(final String key) {
  6. try {
  7. return (String) AccessController.doPrivileged(
  8. new PrivilegedAction() {
  9. public Object run() {
  10. return System.getProperty(key, null);
  11. }
  12. });
  13. } catch (AccessControlException e) {
  14. logWarnInLogger("Insufficient permissions to read system property \"" + key + "\".");
  15. return null;
  16. } catch (Throwable e) {
  17. logErrorInLogger("Failed to read system property \"" + key + "\".", e);
  18. return null;
  19. }
  20. }

代码示例来源:origin: org.freemarker/freemarker

  1. loggersByCategory.clear();
  2. if (loggerFactoryWasAlreadySet) {
  3. logWarnInLogger("Logger library was already set earlier to \""
  4. + getLibraryName(replacedLibraryEnum) + "\"; "
  5. + "change to \"" + getLibraryName(libraryEnum) + "\" won't effect loggers created "
  6. logWarnInLogger("Ignored " + Logger.class.getName() + ".selectLoggerLibrary(\""
  7. + getLibraryName(libraryEnum)
  8. + "\") call, because the \"" + SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY

代码示例来源:origin: org.freemarker/freemarker

  1. logWarnInLogger("Ignored invalid \"" + SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY
  2. + "\" system property value: \"" + sysPropVal + "\"");
  3. if (onlyIfCanBeSetFromSysProp) return;

代码示例来源:origin: org.freemarker/freemarker

  1. /**
  2. * @throws ClassNotFoundException
  3. * If the requested logger library is not available. Never thrown for {@link #LIBRARY_AUTO}.
  4. */
  5. private static LoggerFactory createLoggerFactory(int libraryEnum) throws ClassNotFoundException {
  6. if (libraryEnum == LIBRARY_AUTO) {
  7. for (int libraryEnumToTry = MAX_LIBRARY_ENUM; libraryEnumToTry >= MIN_LIBRARY_ENUM; libraryEnumToTry--) {
  8. if (!isAutoDetected(libraryEnumToTry)) continue;
  9. if (libraryEnumToTry == LIBRARY_LOG4J && hasLog4LibraryThatDelegatesToWorkingSLF4J()) {
  10. libraryEnumToTry = LIBRARY_SLF4J;
  11. }
  12. try {
  13. return createLoggerFactoryForNonAuto(libraryEnumToTry);
  14. } catch (ClassNotFoundException e) {
  15. // Expected, intentionally suppressed.
  16. } catch (Throwable e) {
  17. logErrorInLogger(
  18. "Unexpected error when initializing logging for \""
  19. + getLibraryName(libraryEnumToTry) + "\".",
  20. e);
  21. }
  22. }
  23. logWarnInLogger("Auto detecton couldn't set up any logger libraries; FreeMarker logging suppressed.");
  24. return new _NullLoggerFactory();
  25. } else {
  26. return createLoggerFactoryForNonAuto(libraryEnum);
  27. }
  28. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

  1. /**
  2. * Don't use {@link freemarker.template.utility.SecurityUtilities#getSystemProperty(String, String)} here, as it
  3. * (might) depends on the logger, hence interfering with the initialization.
  4. */
  5. private static String getSystemProperty(final String key) {
  6. try {
  7. return (String) AccessController.doPrivileged(
  8. new PrivilegedAction() {
  9. public Object run() {
  10. return System.getProperty(key, null);
  11. }
  12. });
  13. } catch (AccessControlException e) {
  14. logWarnInLogger("Insufficient permissions to read system property \"" + key + "\".");
  15. return null;
  16. } catch (Throwable e) {
  17. logErrorInLogger("Failed to read system property \"" + key + "\".", e);
  18. return null;
  19. }
  20. }

代码示例来源:origin: org.freemarker/freemarker-gae

  1. /**
  2. * Don't use {@link freemarker.template.utility.SecurityUtilities#getSystemProperty(String, String)} here, as it
  3. * (might) depends on the logger, hence interfering with the initialization.
  4. */
  5. private static String getSystemProperty(final String key) {
  6. try {
  7. return (String) AccessController.doPrivileged(
  8. new PrivilegedAction() {
  9. public Object run() {
  10. return System.getProperty(key, null);
  11. }
  12. });
  13. } catch (AccessControlException e) {
  14. logWarnInLogger("Insufficient permissions to read system property \"" + key + "\".");
  15. return null;
  16. } catch (Throwable e) {
  17. logErrorInLogger("Failed to read system property \"" + key + "\".", e);
  18. return null;
  19. }
  20. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

  1. loggersByCategory.clear();
  2. if (loggerFactoryWasAlreadySet) {
  3. logWarnInLogger("Logger library was already set earlier to \""
  4. + getLibraryName(replacedLibraryEnum) + "\"; "
  5. + "change to \"" + getLibraryName(libraryEnum) + "\" won't effect loggers created "
  6. logWarnInLogger("Ignored " + Logger.class.getName() + ".selectLoggerLibrary(\""
  7. + getLibraryName(libraryEnum)
  8. + "\") call, because the \"" + SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY

代码示例来源:origin: org.freemarker/freemarker-gae

  1. loggersByCategory.clear();
  2. if (loggerFactoryWasAlreadySet) {
  3. logWarnInLogger("Logger library was already set earlier to \""
  4. + getLibraryName(replacedLibraryEnum) + "\"; "
  5. + "change to \"" + getLibraryName(libraryEnum) + "\" won't effect loggers created "
  6. logWarnInLogger("Ignored " + Logger.class.getName() + ".selectLoggerLibrary(\""
  7. + getLibraryName(libraryEnum)
  8. + "\") call, because the \"" + SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY

代码示例来源:origin: org.freemarker/freemarker-gae

  1. logWarnInLogger("Ignored invalid \"" + SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY
  2. + "\" system property value: \"" + sysPropVal + "\"");
  3. if (onlyIfCanBeSetFromSysProp) return;

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

  1. logWarnInLogger("Ignored invalid \"" + SYSTEM_PROPERTY_NAME_LOGGER_LIBRARY
  2. + "\" system property value: \"" + sysPropVal + "\"");
  3. if (onlyIfCanBeSetFromSysProp) return;

代码示例来源:origin: org.freemarker/freemarker-gae

  1. /**
  2. * @throws ClassNotFoundException
  3. * If the requested logger library is not available. Never thrown for {@link #LIBRARY_AUTO}.
  4. */
  5. private static LoggerFactory createLoggerFactory(int libraryEnum) throws ClassNotFoundException {
  6. if (libraryEnum == LIBRARY_AUTO) {
  7. for (int libraryEnumToTry = MAX_LIBRARY_ENUM; libraryEnumToTry >= MIN_LIBRARY_ENUM; libraryEnumToTry--) {
  8. if (!isAutoDetected(libraryEnumToTry)) continue;
  9. if (libraryEnumToTry == LIBRARY_LOG4J && hasLog4LibraryThatDelegatesToWorkingSLF4J()) {
  10. libraryEnumToTry = LIBRARY_SLF4J;
  11. }
  12. try {
  13. return createLoggerFactoryForNonAuto(libraryEnumToTry);
  14. } catch (ClassNotFoundException e) {
  15. // Expected, intentionally suppressed.
  16. } catch (Throwable e) {
  17. logErrorInLogger(
  18. "Unexpected error when initializing logging for \""
  19. + getLibraryName(libraryEnumToTry) + "\".",
  20. e);
  21. }
  22. }
  23. logWarnInLogger("Auto detecton couldn't set up any logger libraries; FreeMarker logging suppressed.");
  24. return new _NullLoggerFactory();
  25. } else {
  26. return createLoggerFactoryForNonAuto(libraryEnum);
  27. }
  28. }

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker

  1. /**
  2. * @throws ClassNotFoundException
  3. * If the requested logger library is not available. Never thrown for {@link #LIBRARY_AUTO}.
  4. */
  5. private static LoggerFactory createLoggerFactory(int libraryEnum) throws ClassNotFoundException {
  6. if (libraryEnum == LIBRARY_AUTO) {
  7. for (int libraryEnumToTry = MAX_LIBRARY_ENUM; libraryEnumToTry >= MIN_LIBRARY_ENUM; libraryEnumToTry--) {
  8. if (!isAutoDetected(libraryEnumToTry)) continue;
  9. if (libraryEnumToTry == LIBRARY_LOG4J && hasLog4LibraryThatDelegatesToWorkingSLF4J()) {
  10. libraryEnumToTry = LIBRARY_SLF4J;
  11. }
  12. try {
  13. return createLoggerFactoryForNonAuto(libraryEnumToTry);
  14. } catch (ClassNotFoundException e) {
  15. // Expected, intentionally suppressed.
  16. } catch (Throwable e) {
  17. logErrorInLogger(
  18. "Unexpected error when initializing logging for \""
  19. + getLibraryName(libraryEnumToTry) + "\".",
  20. e);
  21. }
  22. }
  23. logWarnInLogger("Auto detecton couldn't set up any logger libraries; FreeMarker logging suppressed.");
  24. return new _NullLoggerFactory();
  25. } else {
  26. return createLoggerFactoryForNonAuto(libraryEnum);
  27. }
  28. }

相关文章