ch.qos.logback.core.joran.GenericConfigurator.getContext()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(11.8k)|赞(0)|评价(0)|浏览(72)

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

GenericConfigurator.getContext介绍

暂无

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

public final void doConfigure(File file) throws JoranException {
 FileInputStream fis = null;
 try {
  informContextOfURLUsedForConfiguration(getContext(), file.toURI().toURL());
  fis = new FileInputStream(file);
  doConfigure(fis);
 } catch (IOException ioe) {
  String errMsg = "Could not open [" + file.getPath() + "].";
  addError(errMsg, ioe);
  throw new JoranException(errMsg, ioe);
 } finally {
  if (fis != null) {
   try {
    fis.close();
   } catch (java.io.IOException ioe) {
    String errMsg = "Could not close [" + file.getName() + "].";
    addError(errMsg, ioe);
    throw new JoranException(errMsg, ioe);
   }
  }
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

public final void doConfigure(URL url) throws JoranException {
 InputStream in = null;
 try {
  informContextOfURLUsedForConfiguration(getContext(), url);
  URLConnection urlConnection = url.openConnection();
  // per http://jira.qos.ch/browse/LBCORE-105
  // per http://jira.qos.ch/browse/LBCORE-127
  urlConnection.setUseCaches(false);
  in = urlConnection.getInputStream();
  doConfigure(in);
 } catch (IOException ioe) {
  String errMsg = "Could not open URL [" + url + "].";
  addError(errMsg, ioe);
  throw new JoranException(errMsg, ioe);
 } finally {
  if (in != null) {
   try {
    in.close();
   } catch (IOException ioe) {
    String errMsg = "Could not close input stream";
    addError(errMsg, ioe);
    throw new JoranException(errMsg, ioe);
   }
  }
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

public final void doConfigure(final InputSource inputSource)
    throws JoranException {
 long threshold = System.currentTimeMillis();
 if (!ConfigurationWatchListUtil.wasConfigurationWatchListReset(context)) {
  informContextOfURLUsedForConfiguration(getContext(), null);
 }
 SaxEventRecorder recorder = new SaxEventRecorder(context);
 recorder.recordEvents(inputSource);
 doConfigure(recorder.saxEventList);
 // no exceptions a this level
 StatusUtil statusUtil = new StatusUtil(context);
 if (statusUtil.noXMLParsingErrorsOccurred(threshold)) {
  addInfo("Registering current configuration as safe fallback point");
  registerSafeConfiguration();
 }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

protected BeanDescriptionCache getBeanDescriptionCache() {
  if (beanDescriptionCache == null) {
    beanDescriptionCache = new BeanDescriptionCache(getContext());
  }
  return beanDescriptionCache;
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

protected BeanDescriptionCache getBeanDescriptionCache() {
  if (beanDescriptionCache == null) {
    beanDescriptionCache = new BeanDescriptionCache(getContext());
  }
  return beanDescriptionCache;
}

代码示例来源:origin: Nextdoor/bender

protected BeanDescriptionCache getBeanDescriptionCache() {
  if (beanDescriptionCache == null) {
    beanDescriptionCache = new BeanDescriptionCache(getContext());
  }
  return beanDescriptionCache;
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

protected void informContextOfURLUsedForConfiguration(URL url) {
 getContext().putObject(CoreConstants.URL_OF_LAST_CONFIGURATION_VIA_JORAN, url);
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

public final void doConfigure(File file) throws JoranException {
  FileInputStream fis = null;
  try {
    URL url = file.toURI().toURL();
    informContextOfURLUsedForConfiguration(getContext(), url);
    fis = new FileInputStream(file);
    doConfigure(fis, url.toExternalForm());
  } catch (IOException ioe) {
    String errMsg = "Could not open [" + file.getPath() + "].";
    addError(errMsg, ioe);
    throw new JoranException(errMsg, ioe);
  } finally {
    if (fis != null) {
      try {
        fis.close();
      } catch (java.io.IOException ioe) {
        String errMsg = "Could not close [" + file.getName() + "].";
        addError(errMsg, ioe);
        throw new JoranException(errMsg, ioe);
      }
    }
  }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

public final void doConfigure(File file) throws JoranException {
  FileInputStream fis = null;
  try {
    URL url = file.toURI().toURL();
    informContextOfURLUsedForConfiguration(getContext(), url);
    fis = new FileInputStream(file);
    doConfigure(fis, url.toExternalForm());
  } catch (IOException ioe) {
    String errMsg = "Could not open [" + file.getPath() + "].";
    addError(errMsg, ioe);
    throw new JoranException(errMsg, ioe);
  } finally {
    if (fis != null) {
      try {
        fis.close();
      } catch (java.io.IOException ioe) {
        String errMsg = "Could not close [" + file.getName() + "].";
        addError(errMsg, ioe);
        throw new JoranException(errMsg, ioe);
      }
    }
  }
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.core

public final void doConfigure(File file) throws JoranException {
 FileInputStream fis = null;
 try {
  informContextOfURLUsedForConfiguration(getContext(), file.toURI().toURL());
  fis = new FileInputStream(file);
  doConfigure(fis);
 } catch (IOException ioe) {
  String errMsg = "Could not open [" + file.getPath() + "].";
  addError(errMsg, ioe);
  throw new JoranException(errMsg, ioe);
 } finally {
  if (fis != null) {
   try {
    fis.close();
   } catch (java.io.IOException ioe) {
    String errMsg = "Could not close [" + file.getName() + "].";
    addError(errMsg, ioe);
    throw new JoranException(errMsg, ioe);
   }
  }
 }
}

代码示例来源:origin: tony19/logback-android

/**
 * Configures logback with the configuration XML read from a given file
 *
 * @param file the file, containing the configuration XML
 * @throws JoranException configuration error occurred
 */
public final void doConfigure(File file) throws JoranException {
 FileInputStream fis = null;
 try {
  URL url = file.toURI().toURL();
  informContextOfURLUsedForConfiguration(getContext(), url);
  fis = new FileInputStream(file);
  // this closes the stream for us
  doConfigure(fis, url.toExternalForm());
 } catch (IOException ioe) {
  String errMsg = "Could not open [" + file.getPath() + "].";
  addError(errMsg, ioe);
  throw new JoranException(errMsg, ioe);
 } finally {
  CloseUtil.closeQuietly(fis);
 }
}

代码示例来源:origin: ch.qos.logback/core

public final void doConfigure(File file) throws JoranException {
 FileInputStream fis = null;
 try {
  informContextOfURLUsedForConfiguration(getContext(), file.toURI().toURL());
  fis = new FileInputStream(file);
  doConfigure(fis);
 } catch (IOException ioe) {
  String errMsg = "Could not open [" + file.getPath() + "].";
  addError(errMsg, ioe);
  throw new JoranException(errMsg, ioe);
 } finally {
  if (fis != null) {
   try {
    fis.close();
   } catch (java.io.IOException ioe) {
    String errMsg = "Could not close [" + file.getName() + "].";
    addError(errMsg, ioe);
    throw new JoranException(errMsg, ioe);
   }
  }
 }
}

代码示例来源:origin: com.hynnet/logback-core

public final void doConfigure(File file) throws JoranException {
 FileInputStream fis = null;
 try {
  informContextOfURLUsedForConfiguration(getContext(), file.toURI().toURL());
  fis = new FileInputStream(file);
  doConfigure(fis);
 } catch (IOException ioe) {
  String errMsg = "Could not open [" + file.getPath() + "].";
  addError(errMsg, ioe);
  throw new JoranException(errMsg, ioe);
 } finally {
  if (fis != null) {
   try {
    fis.close();
   } catch (java.io.IOException ioe) {
    String errMsg = "Could not close [" + file.getName() + "].";
    addError(errMsg, ioe);
    throw new JoranException(errMsg, ioe);
   }
  }
 }
}

代码示例来源:origin: tony19/logback-android

/**
 * Configures logback with the configuration XML read from a file,
 * located at the given URL
 *
 * @param url URL to the file, containing the configuration XML
 * @throws JoranException configuration error occurred
 */
public final void doConfigure(URL url) throws JoranException {
 InputStream in = null;
 try {
  informContextOfURLUsedForConfiguration(getContext(), url);
  URLConnection urlConnection = url.openConnection();
  // per http://jira.qos.ch/browse/LBCORE-105
  // per http://jira.qos.ch/browse/LBCORE-127
  urlConnection.setUseCaches(false);
  // this closes the stream for us
  in = urlConnection.getInputStream();
  doConfigure(in, url.toExternalForm());
 } catch (IOException ioe) {
  String errMsg = "Could not open URL [" + url + "].";
  addError(errMsg, ioe);
  throw new JoranException(errMsg, ioe);
 } finally {
  CloseUtil.closeQuietly(in);
 }
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

public final void doConfigure(URL url) throws JoranException {
  InputStream in = null;
  try {
    informContextOfURLUsedForConfiguration(getContext(), url);
    URLConnection urlConnection = url.openConnection();
    // per http://jira.qos.ch/browse/LBCORE-105
    // per http://jira.qos.ch/browse/LBCORE-127
    urlConnection.setUseCaches(false);
    in = urlConnection.getInputStream();
    doConfigure(in, url.toExternalForm());
  } catch (IOException ioe) {
    String errMsg = "Could not open URL [" + url + "].";
    addError(errMsg, ioe);
    throw new JoranException(errMsg, ioe);
  } finally {
    if (in != null) {
      try {
        in.close();
      } catch (IOException ioe) {
        String errMsg = "Could not close input stream";
        addError(errMsg, ioe);
        throw new JoranException(errMsg, ioe);
      }
    }
  }
}

代码示例来源:origin: com.hynnet/logback-core

public final void doConfigure(URL url) throws JoranException {
 InputStream in = null;
 try {
  informContextOfURLUsedForConfiguration(getContext(), url);
  URLConnection urlConnection = url.openConnection();
  // per http://jira.qos.ch/browse/LBCORE-105
  // per http://jira.qos.ch/browse/LBCORE-127
  urlConnection.setUseCaches(false);
  in = urlConnection.getInputStream();
  doConfigure(in);
 } catch (IOException ioe) {
  String errMsg = "Could not open URL [" + url + "].";
  addError(errMsg, ioe);
  throw new JoranException(errMsg, ioe);
 } finally {
  if (in != null) {
   try {
    in.close();
   } catch (IOException ioe) {
    String errMsg = "Could not close input stream";
    addError(errMsg, ioe);
    throw new JoranException(errMsg, ioe);
   }
  }
 }
}

代码示例来源:origin: ch.qos.logback/core

public final void doConfigure(URL url) throws JoranException {
 InputStream in = null;
 try {
  informContextOfURLUsedForConfiguration(getContext(), url);
  URLConnection urlConnection = url.openConnection();
  // per http://jira.qos.ch/browse/LBCORE-105
  // per http://jira.qos.ch/browse/LBCORE-127
  urlConnection.setUseCaches(false);
  in = urlConnection.getInputStream();
  doConfigure(in);
 } catch (IOException ioe) {
  String errMsg = "Could not open URL [" + url + "].";
  addError(errMsg, ioe);
  throw new JoranException(errMsg, ioe);
 } finally {
  if (in != null) {
   try {
    in.close();
   } catch (IOException ioe) {
    String errMsg = "Could not close input stream";
    addError(errMsg, ioe);
    throw new JoranException(errMsg, ioe);
   }
  }
 }
}

代码示例来源:origin: com.hynnet/logback-core

public final void doConfigure(final InputSource inputSource)
    throws JoranException {
 long threshold = System.currentTimeMillis();
 if (!ConfigurationWatchListUtil.wasConfigurationWatchListReset(context)) {
  informContextOfURLUsedForConfiguration(getContext(), null);
 }
 SaxEventRecorder recorder = new SaxEventRecorder(context);
 recorder.recordEvents(inputSource);
 doConfigure(recorder.saxEventList);
 // no exceptions a this level
 StatusUtil statusUtil = new StatusUtil(context);
 if (statusUtil.noXMLParsingErrorsOccurred(threshold)) {
  addInfo("Registering current configuration as safe fallback point");
  registerSafeConfiguration();
 }
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.core

public final void doConfigure(final InputSource inputSource)
    throws JoranException {
 long threshold = System.currentTimeMillis();
 if (!ConfigurationWatchListUtil.wasConfigurationWatchListReset(context)) {
  informContextOfURLUsedForConfiguration(getContext(), null);
 }
 SaxEventRecorder recorder = new SaxEventRecorder();
 recorder.setContext(context);
 recorder.recordEvents(inputSource);
 doConfigure(recorder.saxEventList);
 // no exceptions a this level
 StatusChecker statusChecker = new StatusChecker(context);
 if (statusChecker.noXMLParsingErrorsOccurred(threshold)) {
  addInfo("Registering current configuration as safe fallback point");
  registerSafeConfiguration();
 }
}

代码示例来源:origin: ch.qos.logback/core

public final void doConfigure(final InputSource inputSource)
    throws JoranException {
 long threshold = System.currentTimeMillis();
 if (!ConfigurationWatchListUtil.wasConfigurationWatchListReset(context)) {
  informContextOfURLUsedForConfiguration(getContext(), null);
 }
 SaxEventRecorder recorder = new SaxEventRecorder();
 recorder.setContext(context);
 recorder.recordEvents(inputSource);
 doConfigure(recorder.saxEventList);
 // no exceptions a this level
 StatusChecker statusChecker = new StatusChecker(context);
 if (statusChecker.noXMLParsingErrorsOccurred(threshold)) {
  addInfo("Registering current configuration as safe fallback point");
  registerSafeConfiguration();
 }
}

相关文章