org.apache.openejb.util.Logger.getChildLogger()方法的使用及代码示例

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

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

Logger.getChildLogger介绍

暂无

代码示例

代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-core

private void logUnusedProperties(Map<String, Object> unsetProperties, ServiceInfo info) {
  for (String property : unsetProperties.keySet()) {
    //TODO: DMB: Make more robust later
    if (property.equalsIgnoreCase("properties")) return;
    if (property.equalsIgnoreCase("transactionManager")) return;
    if (info.types.contains("javax.mail.Session")) return;
    //---
    logger.getChildLogger("service").warning("unusedProperty", property, info.id);
  }
}

代码示例来源:origin: org.apache.openejb/openejb-core

private static void unusedProperty(final String id, final Logger parentLogger, final String property) {
  parentLogger.getChildLogger("service").warning("unusedProperty", property, id);
}

代码示例来源:origin: org.apache.openejb/openejb-core

public JtaEntityManager(final String unitName, final JtaEntityManagerRegistry registry, final EntityManagerFactory entityManagerFactory, final Map properties, final boolean extended) {
  if (registry == null) {
    throw new NullPointerException("registry is null");
  }
  if (entityManagerFactory == null) {
    throw new NullPointerException("entityManagerFactory is null");
  }
  this.unitName = unitName;
  this.registry = registry;
  this.entityManagerFactory = entityManagerFactory;
  this.properties = properties;
  this.extended = extended;
  logger = unitName == null ? baseLogger : baseLogger.getChildLogger(unitName);
  final String wrapConfig = ReloadableEntityManagerFactory.class.isInstance(entityManagerFactory) ?
      ReloadableEntityManagerFactory.class.cast(entityManagerFactory).getUnitProperties().getProperty("openejb.jpa.query.wrap-no-tx", "true") : "true";
  this.wrapNoTxQueries = wrapConfig == null || "true".equalsIgnoreCase(wrapConfig);
}

代码示例来源:origin: org.apache.tomee/openejb-core

private static void unusedProperty(final String id, final Logger parentLogger, final String property) {
  if (isInternalProperty(property)) {
    return;
  }
  final String msg = "unused property '" + property + "' for resource '" + id + "'";
  if (null != parentLogger) {
    parentLogger.getChildLogger("service").warning(msg);
  } else { // note: we should throw an exception if this is called, shouldnt be possible in our lifecycle
    System.out.println(msg);
  }
}

代码示例来源:origin: org.apache.tomee/openejb-core

@Override
  public void run() {
    try {
      stopImpl();
    } catch (final Throwable t) {
      Logger.getInstance(LogCategory.OPENEJB_STARTUP, ActiveMQResourceAdapter.class).getChildLogger("service").error("ActiveMQ shutdown failed", t);
    }
  }
};

代码示例来源:origin: org.apache.openejb/openejb-core

@Override
  public void run() {
    try {
      stopImpl();
    } catch (final Throwable t) {
      Logger.getInstance(LogCategory.OPENEJB_STARTUP, ActiveMQResourceAdapter.class).getChildLogger("service").error("ActiveMQ shutdown failed", t);
    }
  }
};

代码示例来源:origin: org.apache.openejb/openejb-core

public void createExternalContext(final JndiContextInfo contextInfo) throws OpenEJBException {
  logger.getChildLogger("service").info("createService", contextInfo.service, contextInfo.id, contextInfo.className);
  final InitialContext initialContext;
  try {
    initialContext = new InitialContext(contextInfo.properties);
  } catch (final NamingException ne) {
    throw new OpenEJBException(String.format("JndiProvider(id=\"%s\") could not be created.  Failed to create the InitialContext using the supplied properties",
        contextInfo.id), ne);
  }
  try {
    containerSystem.getJNDIContext().bind("openejb/remote_jndi_contexts/" + contextInfo.id, initialContext);
  } catch (final NamingException e) {
    throw new OpenEJBException("Cannot bind " + contextInfo.service + " with id " + contextInfo.id, e);
  }
  // Update the config tree
  config.facilities.remoteJndiContexts.add(contextInfo);
  logger.getChildLogger("service").debug("createService.success", contextInfo.service, contextInfo.id, contextInfo.className);
}

代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-core

public void createExternalContext(JndiContextInfo contextInfo) throws OpenEJBException {
  logger.getChildLogger("service").info("createService", contextInfo.service, contextInfo.id, contextInfo.className);
  InitialContext result;
  try {
    InitialContext ic = new InitialContext(contextInfo.properties);
    result = ic;
  } catch (NamingException ne) {
    throw new OpenEJBException("The remote JNDI EJB references for remote-jndi-contexts = " + contextInfo.id + "+ could not be resolved.", ne);
  }
  InitialContext cntx = result;
  try {
    containerSystem.getJNDIContext().bind("openejb/remote_jndi_contexts/" + contextInfo.id, cntx);
  } catch (NamingException e) {
    throw new OpenEJBException("Cannot bind " + contextInfo.service + " with id " + contextInfo.id, e);
  }
  // Update the config tree
  config.facilities.remoteJndiContexts.add(contextInfo);
  logger.getChildLogger("service").debug("createService.success", contextInfo.service, contextInfo.id, contextInfo.className);
}

代码示例来源:origin: org.apache.tomee/openejb-core

public void createService(final ServiceInfo serviceInfo) throws OpenEJBException {
  final ObjectRecipe serviceRecipe = createRecipe(Collections.<ServiceInfo>emptyList(), serviceInfo);
  serviceRecipe.setProperty("properties", new UnsetPropertiesRecipe());
  final Object service = serviceRecipe.create();
  SystemInstance.get().addObserver(service);
  logUnusedProperties(serviceRecipe, serviceInfo);
  final Class<?> serviceClass = service.getClass();
  getContext().put(serviceClass.getName(), service);
  props.put(serviceClass.getName(), service);
  props.put(serviceInfo.service, service);
  props.put(serviceInfo.id, service);
  config.facilities.services.add(serviceInfo);
  logger.getChildLogger("service").debug("createService.success", serviceInfo.service, serviceInfo.id, serviceInfo.className);
}

代码示例来源:origin: org.apache.openejb/openejb-core

public void createService(final ServiceInfo serviceInfo) throws OpenEJBException {
  final ObjectRecipe serviceRecipe = createRecipe(serviceInfo);
  serviceRecipe.setProperty("properties", new UnsetPropertiesRecipe());
  final Object service = serviceRecipe.create();
  SystemInstance.get().addObserver(service);
  logUnusedProperties(serviceRecipe, serviceInfo);
  final Class<?> serviceClass = service.getClass();
  getContext().put(serviceClass.getName(), service);
  props.put(serviceClass.getName(), service);
  props.put(serviceInfo.service, service);
  props.put(serviceInfo.id, service);
  config.facilities.services.add(serviceInfo);
  logger.getChildLogger("service").debug("createService.success", serviceInfo.service, serviceInfo.id, serviceInfo.className);
}

代码示例来源:origin: org.apache.tomee/openejb-core

public void createConnectionManager(final ConnectionManagerInfo serviceInfo) throws OpenEJBException {
  final ObjectRecipe serviceRecipe = createRecipe(Collections.<ServiceInfo>emptyList(), serviceInfo);
  final Object object = props.get("TransactionManager");
  serviceRecipe.setProperty("transactionManager", object);
  final Object service = serviceRecipe.create();
  logUnusedProperties(serviceRecipe, serviceInfo);
  final Class interfce = serviceInterfaces.get(serviceInfo.service);
  checkImplementation(interfce, service.getClass(), serviceInfo.service, serviceInfo.id);
  bindService(serviceInfo, service);
  setSystemInstanceComponent(interfce, service);
  getContext().put(interfce.getName(), service);
  props.put(interfce.getName(), service);
  props.put(serviceInfo.service, service);
  props.put(serviceInfo.id, service);
  // Update the config tree
  config.facilities.connectionManagers.add(serviceInfo);
  logger.getChildLogger("service").debug("createService.success", serviceInfo.service, serviceInfo.id, serviceInfo.className);
}

代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-core

private ObjectRecipe createRecipe(ServiceInfo info) {
  Logger serviceLogger = logger.getChildLogger("service");
  serviceLogger.info("createService", info.service, info.id, info.className);
  String[] constructorArgs = info.constructorArgs.toArray(new String[info.constructorArgs.size()]);
  ObjectRecipe serviceRecipe = new ObjectRecipe(info.className, info.factoryMethod, constructorArgs, null);
  serviceRecipe.allow(Option.CASE_INSENSITIVE_PROPERTIES);
  serviceRecipe.allow(Option.IGNORE_MISSING_PROPERTIES);
  serviceRecipe.setAllProperties(info.properties);
  if (serviceLogger.isDebugEnabled()){
    for (Map.Entry<String, Object> entry : serviceRecipe.getProperties().entrySet()) {
      serviceLogger.debug("createService.props", entry.getKey(), entry.getValue());
    }
  }
  return serviceRecipe;
}

代码示例来源:origin: org.apache.tomee/openejb-core

public void createProxyFactory(final ProxyFactoryInfo serviceInfo) throws OpenEJBException {
  final ObjectRecipe serviceRecipe = createRecipe(Collections.<ServiceInfo>emptyList(), serviceInfo);
  final Object service = serviceRecipe.create();
  logUnusedProperties(serviceRecipe, serviceInfo);
  final Class interfce = serviceInterfaces.get(serviceInfo.service);
  checkImplementation(interfce, service.getClass(), serviceInfo.service, serviceInfo.id);
  ProxyManager.registerFactory(serviceInfo.id, (ProxyFactory) service);
  ProxyManager.setDefaultFactory(serviceInfo.id);
  bindService(serviceInfo, service);
  setSystemInstanceComponent(interfce, service);
  getContext().put(interfce.getName(), service);
  props.put(interfce.getName(), service);
  props.put(serviceInfo.service, service);
  props.put(serviceInfo.id, service);
  // Update the config tree
  config.facilities.intraVmServer = serviceInfo;
  logger.getChildLogger("service").debug("createService.success", serviceInfo.service, serviceInfo.id, serviceInfo.className);
}

代码示例来源:origin: org.apache.openejb/openejb-core

public void createProxyFactory(final ProxyFactoryInfo serviceInfo) throws OpenEJBException {
  final ObjectRecipe serviceRecipe = createRecipe(serviceInfo);
  final Object service = serviceRecipe.create();
  logUnusedProperties(serviceRecipe, serviceInfo);
  final Class interfce = serviceInterfaces.get(serviceInfo.service);
  checkImplementation(interfce, service.getClass(), serviceInfo.service, serviceInfo.id);
  ProxyManager.registerFactory(serviceInfo.id, (ProxyFactory) service);
  ProxyManager.setDefaultFactory(serviceInfo.id);
  bindService(serviceInfo, service);
  setSystemInstanceComponent(interfce, service);
  getContext().put(interfce.getName(), service);
  props.put(interfce.getName(), service);
  props.put(serviceInfo.service, service);
  props.put(serviceInfo.id, service);
  // Update the config tree
  config.facilities.intraVmServer = serviceInfo;
  logger.getChildLogger("service").debug("createService.success", serviceInfo.service, serviceInfo.id, serviceInfo.className);
}

代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-core

public void createProxyFactory(ProxyFactoryInfo serviceInfo) throws OpenEJBException {
  ObjectRecipe serviceRecipe = createRecipe(serviceInfo);
  Object service = serviceRecipe.create();
  logUnusedProperties(serviceRecipe, serviceInfo);
  Class interfce = serviceInterfaces.get(serviceInfo.service);
  checkImplementation(interfce, service.getClass(), serviceInfo.service, serviceInfo.id);
  ProxyManager.registerFactory(serviceInfo.id, (ProxyFactory) service);
  ProxyManager.setDefaultFactory(serviceInfo.id);
  bindService(serviceInfo, service);
  setSystemInstanceComponent(interfce, service);
  getContext().put(interfce.getName(), service);
  props.put(interfce.getName(), service);
  props.put(serviceInfo.service, service);
  props.put(serviceInfo.id, service);
  // Update the config tree
  config.facilities.intraVmServer = serviceInfo;
  logger.getChildLogger("service").debug("createService.success", serviceInfo.service, serviceInfo.id, serviceInfo.className);
}

代码示例来源:origin: org.apache.openejb/openejb-core

private void stopImpl() throws Exception {
  super.stop();
  final Collection<BrokerService> brokers = ActiveMQFactory.getBrokers();
  final Iterator<BrokerService> it = brokers.iterator();
  while (it.hasNext()) {
    final BrokerService bs = it.next();
    try {
      bs.stop();
      bs.waitUntilStopped();
    } catch (final Throwable t) {
      //Ignore
    }
    it.remove();
  }
  stopScheduler();
  Logger.getInstance(LogCategory.OPENEJB_STARTUP, ActiveMQResourceAdapter.class).getChildLogger("service").info("Stopped ActiveMQ broker");
}

代码示例来源:origin: org.apache.tomee/openejb-core

private void stopImpl() throws Exception {
  super.stop();
  final Collection<BrokerService> brokers = ActiveMQFactory.getBrokers();
  final Iterator<BrokerService> it = brokers.iterator();
  while (it.hasNext()) {
    final BrokerService bs = it.next();
    try {
      bs.stop();
      bs.waitUntilStopped();
    } catch (final Throwable t) {
      //Ignore
    }
    it.remove();
  }
  stopScheduler();
  Logger.getInstance(LogCategory.OPENEJB_STARTUP, ActiveMQResourceAdapter.class).getChildLogger("service").info("Stopped ActiveMQ broker");
}

代码示例来源:origin: org.apache.tomee/openejb-core

@Override
  public NetworkConnector addNetworkConnector(final URI discoveryAddress) throws Exception {
    final NetworkConnector connector = new DiscoveryNetworkConnector(discoveryAddress);
    try { // try to set properties to broker too
      final Map<String, String> props = URISupport.parseParameters(discoveryAddress);
      if (!props.containsKey("skipConnector")) {
        IntrospectionSupport.setProperties(connector, props);
      }
    } catch (final URISyntaxException e) {
      // low level cause not supported by AMQ by default
      Logger.getInstance(LogCategory.OPENEJB_STARTUP, ActiveMQ5Factory.class).getChildLogger("service")
          .debug(e.getMessage());
    }
    return addNetworkConnector(connector);
  }
};

代码示例来源:origin: org.apache.openejb/openejb-core

private void createInternalBroker(final String brokerXmlConfig, final Properties properties) {
  ActiveMQFactory.setThreadProperties(properties);
  try {
    //The returned broker should be started, but calling start is harmless.
    //We do not need to track the instance as the factory takes care of this.
    ActiveMQFactory.createBroker(URLs.uri(getBrokerXmlConfig())).start();
  } catch (final Exception e) {
    Logger.getInstance(LogCategory.OPENEJB_STARTUP, ActiveMQResourceAdapter.class).getChildLogger("service").fatal("Failed to start ActiveMQ", e);
  } finally {
    ActiveMQFactory.setThreadProperties(null);
    // reset brokerXmlConfig
    if (brokerXmlConfig != null) {
      setBrokerXmlConfig(brokerXmlConfig);
    }
  }
}

代码示例来源:origin: org.apache.tomee/openejb-core

private void createInternalBroker(final String brokerXmlConfig, final Properties properties) {
  ActiveMQFactory.setThreadProperties(properties);
  try {
    //The returned broker should be started, but calling start is harmless.
    //We do not need to track the instance as the factory takes care of this.
    ActiveMQFactory.createBroker(URLs.uri(getBrokerXmlConfig())).start();
  } catch (final Exception e) {
    Logger.getInstance(LogCategory.OPENEJB_STARTUP, ActiveMQResourceAdapter.class).getChildLogger("service").fatal("Failed to start ActiveMQ", e);
  } finally {
    ActiveMQFactory.setThreadProperties(null);
    // reset brokerXmlConfig
    if (brokerXmlConfig != null) {
      setBrokerXmlConfig(brokerXmlConfig);
    }
  }
}

相关文章