org.objectweb.jonas.common.Log.getLoggerFactory()方法的使用及代码示例

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

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

Log.getLoggerFactory介绍

[英]It returns the unique LoggerFactory used in JOnAS. initialize it if not already done.
[中]它返回JOnAS中使用的唯一LoggerFactory。如果尚未初始化,则初始化它。

代码示例

代码示例来源:origin: org.objectweb.jonas/jonas-commons

/**
 * Shortcut that returns the LevelFactory
 */
public static LevelFactory getLevelFactory() {
  return (LevelFactory) getLoggerFactory();
}

代码示例来源:origin: org.objectweb.jonas/jonas-commons

/**
 * Shortcut to get the Logger by its topic name.
 * @param topic the topic of the returned logger
 * @return always a logger instance (never null value).
 */
public static Logger getLogger(String topic) {
  return getLoggerFactory().getLogger(topic);
}

代码示例来源:origin: org.objectweb.jonas/jonas-commons

/**
 * Configure Logger
 * @param file The configuration file for monolog (usually: trace.properties)
 */
public static void configure(String file) {
  configFile = file;
  getLoggerFactory();
  if (!clientcontainer) {
    P6SpyLogger.logger = lf.getLogger(SPY_LOGGER_NAME);
    // Comment out call until JONAS uses Log4j
    // TraceTm.configure(lf);
  }
}

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

/**
 * @return the topics list. Assumes that all Loggers are TopicalLoggers.
 */
public String[] getTopics() {
  Logger[] logs = Log.getLoggerFactory().getLoggers();
  // put names in alphabetical order
  TreeSet tset = new TreeSet();
  for (int i = 0; i < logs.length; i++) {
    tset.add(logs[i].getName());
  }
  return (String[]) tset.toArray(new String[0]);
}

代码示例来源:origin: org.objectweb.jonas/jonas-commons

/**
 * Returns the standard PrintWriter associated to the logger defined by
 * its topic.
 * This is mainly used for DBM and Connectors.
 */
public static PrintWriter getLogWriter(String topic) {
  // TODO : should not create a new object at each call
  return new PrintWriterImpl(getLogger(topic), getLoggerFactory());
}

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

/**
 * @return list of properties for logging system
 */
public Properties getProperties() {
  Properties props = Log.getProperties();
  if (props == null) {
    Log.getLoggerFactory();
    props = Log.getProperties();
  }
  return props;
}

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

/**
 * Returns the names of the Monolog handlers
 * @return The handler names defines in Monolog
 */
public String[] getHandlerNames() {
  LoggerFactory lf = Log.getLoggerFactory();
  if (lf instanceof HandlerFactory) {
    HandlerFactory mf = (HandlerFactory) lf;
    Handler[] hs = mf.getHandlers();
    String[] hns = new String[hs.length];
    for (int i = 0; i < hs.length; i++) {
      hns[i] = hs[i].getName();
    }
    return hns;
  }
  return null;
}

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

/**
 * Getter for the map of the attributes of a handler.
 * @param handlername the handler name
 * @return The map of the attributes defines for the handler
 */
public Map getHandlerAttributes(final String handlername) {
  LoggerFactory lf = Log.getLoggerFactory();
  if (lf instanceof HandlerFactory) {
    HandlerFactory mf = (HandlerFactory) lf;
    Handler h = mf.getHandler(handlername);
    String[] ans = h.getAttributeNames();
    Map m = new HashMap(ans.length);
    for (int i = 0; i < ans.length; i++) {
      m.put(ans[i], h.getAttribute(ans[i]));
    }
    return m;
  }
  return null;
}

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

/**
 * Return a topic's level
 * @param topic the topic we need ti know its level
 * @return the topic's level
 */
public String getTopicLevel(final String topic) {
  Logger topicLogger = Log.getLoggerFactory().getLogger(topic);
  Level lev = topicLogger.getCurrentLevel();
  return lev.getName();
}

代码示例来源:origin: org.objectweb.jonas/jonas-jca-jdbc-glue

public void getLogger(String _logTopic) throws Exception {
  InitialContext ic = new InitialContext();
  if (trace == null || !(logTopic.equals(_logTopic))) {
    logTopic = _logTopic; // set the log topic value
    // Get the trace module:
    try {
      LoggerFactory mf = Log.getLoggerFactory();
      if (logTopic != null && logTopic.length() > 0) {
        trace = mf.getLogger(logTopic);
      } else if (pw != null) {
        trace = new LoggerImpl(pw);
      } else {
        trace = mf.getLogger("org.objectweb.jonas.jdbc.RA");
      }
    } catch (Exception ex) {
      try {
        if (pw != null) {
          trace = new LoggerImpl(pw);
        }
      } catch (Exception e3) {
        throw new Exception("Cannot get logger");
      }
    }
  }
  isEnabledDebug = trace.isLoggable(BasicLevel.DEBUG);
  if (isEnabledDebug) {
    trace.log(BasicLevel.DEBUG, "getLogger(" + _logTopic + ")");
  }
}

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

/**
 * set Topic Level
 * @param topic topic to set
 * @param level the level to set
 */
public void setTopicLevel(final String topic, final String level) {
  Logger topicLogger = Log.getLoggerFactory().getLogger(topic);
  Level lev = Log.getLevelFactory().getLevel(level);
  // must check null (bug monolog)
  if (lev != null) {
    topicLogger.setLevel(lev);
  } else {
    // TO DO maybe a better error treatement could be found
    throw new RuntimeException("Unknown level " + level);
  }
  // the modified property name is 'logger.topic.level'
  String propName = "logger." + topic + ".level";
  // Send a notification containing the new value of this property to the
  // listner MBean
  sendReconfigNotification(++sequenceNumber, SERVICE_NAME, new PropertiesConfigurationData(propName, level));
}

代码示例来源:origin: org.objectweb.jonas/jonas-ejb-2.1

TraceTimer.configure(Log.getLoggerFactory());
TraceEjb.configure(Log.getLoggerFactory());

相关文章

微信公众号

最新文章

更多