org.jboss.logmanager.Logger.detach()方法的使用及代码示例

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

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

Logger.detach介绍

[英]Remove an attachment.
[中]

代码示例

代码示例来源:origin: org.jboss.logmanager/log4j-jboss-logmanager

  1. @Override
  2. public LoggerNode run() {
  3. return lmLogger.detach(LOGGER_NODE_KEY);
  4. }
  5. });

代码示例来源:origin: org.jboss.logmanager/log4j-jboss-logmanager

  1. loggerNode = lmLogger.detach(LOGGER_NODE_KEY);
  2. } else {
  3. loggerNode = AccessController.doPrivileged(new PrivilegedAction<LoggerNode>() {

代码示例来源:origin: wildfly/wildfly-core

  1. private static void clearLogContext() {
  2. // Remove the configurator and clear the log context
  3. final Configurator configurator = EMBEDDED_LOG_CONTEXT.getLogger("").detach(Configurator.ATTACHMENT_KEY);
  4. // If this was a PropertyConfigurator we can use the LogContextConfiguration API to tear down the LogContext
  5. if (configurator instanceof PropertyConfigurator) {
  6. final LogContextConfiguration logContextConfiguration = ((PropertyConfigurator) configurator).getLogContextConfiguration();
  7. clearLogContext(logContextConfiguration);
  8. } else if (configurator instanceof LogContextConfiguration) {
  9. clearLogContext((LogContextConfiguration) configurator);
  10. } else {
  11. // Remove all the handlers and close them as well as reset the loggers
  12. final List<String> loggerNames = Collections.list(EMBEDDED_LOG_CONTEXT.getLoggerNames());
  13. for (String name : loggerNames) {
  14. final Logger logger = EMBEDDED_LOG_CONTEXT.getLoggerIfExists(name);
  15. if (logger != null) {
  16. final Handler[] handlers = logger.clearHandlers();
  17. if (handlers != null) {
  18. for (Handler handler : handlers) {
  19. handler.close();
  20. }
  21. }
  22. logger.setFilter(null);
  23. logger.setUseParentFilters(false);
  24. logger.setUseParentHandlers(true);
  25. logger.setLevel(Level.INFO);
  26. }
  27. }
  28. }
  29. }

代码示例来源:origin: org.wildfly.core/wildfly-logging

  1. private static void clearLogContext() {
  2. // Remove the configurator and clear the log context
  3. final Configurator configurator = EMBEDDED_LOG_CONTEXT.getLogger("").detach(Configurator.ATTACHMENT_KEY);
  4. // If this was a PropertyConfigurator we can use the LogContextConfiguration API to tear down the LogContext
  5. if (configurator instanceof PropertyConfigurator) {
  6. final LogContextConfiguration logContextConfiguration = ((PropertyConfigurator) configurator).getLogContextConfiguration();
  7. clearLogContext(logContextConfiguration);
  8. } else if (configurator instanceof LogContextConfiguration) {
  9. clearLogContext((LogContextConfiguration) configurator);
  10. } else {
  11. // Remove all the handlers and close them as well as reset the loggers
  12. final List<String> loggerNames = Collections.list(EMBEDDED_LOG_CONTEXT.getLoggerNames());
  13. for (String name : loggerNames) {
  14. final Logger logger = EMBEDDED_LOG_CONTEXT.getLoggerIfExists(name);
  15. if (logger != null) {
  16. final Handler[] handlers = logger.clearHandlers();
  17. if (handlers != null) {
  18. for (Handler handler : handlers) {
  19. handler.close();
  20. }
  21. }
  22. logger.setFilter(null);
  23. logger.setUseParentFilters(false);
  24. logger.setUseParentHandlers(true);
  25. logger.setLevel(Level.INFO);
  26. }
  27. }
  28. }
  29. }

代码示例来源:origin: org.wildfly.core/wildfly-cli

  1. final LogContext embeddedLogContext = Holder.LOG_CONTEXT;
  2. final Configurator configurator = embeddedLogContext.getLogger("").detach(Configurator.ATTACHMENT_KEY);

代码示例来源:origin: wildfly/wildfly-core

  1. final LogContext embeddedLogContext = Holder.LOG_CONTEXT;
  2. final Configurator configurator = embeddedLogContext.getLogger("").detach(Configurator.ATTACHMENT_KEY);

相关文章