org.apache.log4j.Layout.activateOptions()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(163)

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

Layout.activateOptions介绍

暂无

代码示例

代码示例来源:origin: cloudfoundry/uaa

@Override
public void activateOptions() {
  if(lineLayout != null) { lineLayout.activateOptions(); }
  if (messageLayout != null) { messageLayout.activateOptions(); }
}

代码示例来源:origin: apache/flume

rpcClient = RpcClientFactory.getInstance(props);
if (layout != null) {
 layout.activateOptions();

代码示例来源:origin: apache/flume

/**
 * Activate the options set using <tt>setHosts()</tt>, <tt>setSelector</tt>
 * and <tt>setMaxBackoff</tt>
 *
 * @throws FlumeException
 *           if the LoadBalancingRpcClient cannot be instantiated.
 */
@Override
public void activateOptions() throws FlumeException {
 try {
  final Properties properties = getProperties(hosts, selector, maxBackoff, getTimeout());
  rpcClient = RpcClientFactory.getInstance(properties);
  if (layout != null) {
   layout.activateOptions();
  }
  configured = true;
 } catch (Exception e) {
  String errormsg = "RPC client creation failed! " + e.getMessage();
  LogLog.error(errormsg);
  if (getUnsafeMode()) {
   return;
  }
  throw new FlumeException(e);
 }
 initializeClientAddress();
}

代码示例来源:origin: com.norconex.jef/norconex-jef

@Override
public void activateOptions() {
  layout.activateOptions();
}

代码示例来源:origin: kite-sdk/kite

/**
 * Activate the options set using <tt>setPort()</tt>
 * and <tt>setHostname()</tt>
 * @throws FlumeException if the <tt>hostname</tt> and
 *  <tt>port</tt> combination is invalid.
 */
@Override
public void activateOptions() throws FlumeException {
 Properties props = new Properties();
 props.setProperty(RpcClientConfigurationConstants.CONFIG_HOSTS, "h1");
 props.setProperty(RpcClientConfigurationConstants.CONFIG_HOSTS_PREFIX + "h1",
   hostname + ":" + port);
 props.setProperty(RpcClientConfigurationConstants.CONFIG_CONNECT_TIMEOUT,
   String.valueOf(timeout));
 props.setProperty(RpcClientConfigurationConstants.CONFIG_REQUEST_TIMEOUT,
   String.valueOf(timeout));
 try {
  rpcClient = RpcClientFactory.getInstance(props);
  if (layout != null) {
   layout.activateOptions();
  }
 } catch (FlumeException e) {
  String errormsg = "RPC client creation failed! " +
    e.getMessage();
  LogLog.error(errormsg);
  throw e;
 }
}

代码示例来源:origin: org.kitesdk/kite-data-flume

/**
 * Activate the options set using <tt>setPort()</tt>
 * and <tt>setHostname()</tt>
 * @throws FlumeException if the <tt>hostname</tt> and
 *  <tt>port</tt> combination is invalid.
 */
@Override
public void activateOptions() throws FlumeException {
 Properties props = new Properties();
 props.setProperty(RpcClientConfigurationConstants.CONFIG_HOSTS, "h1");
 props.setProperty(RpcClientConfigurationConstants.CONFIG_HOSTS_PREFIX + "h1",
   hostname + ":" + port);
 props.setProperty(RpcClientConfigurationConstants.CONFIG_CONNECT_TIMEOUT,
   String.valueOf(timeout));
 props.setProperty(RpcClientConfigurationConstants.CONFIG_REQUEST_TIMEOUT,
   String.valueOf(timeout));
 try {
  rpcClient = RpcClientFactory.getInstance(props);
  if (layout != null) {
   layout.activateOptions();
  }
 } catch (FlumeException e) {
  String errormsg = "RPC client creation failed! " +
    e.getMessage();
  LogLog.error(errormsg);
  throw e;
 }
}

代码示例来源:origin: stackoverflow.com

public class MultiLayout extends Layout {
 private Layout layout1;
 private Layout layout2;

 public MultiLayout() {
  layout1 = ....;
  layout1.activateOptions();
  layout2 = ....;
  layout2.activateOptions();
 }

 public boolean ignoresThrowable() {
  return layout1.ignoresThrowable();
 }

 public String format(LoggingEvent e) {
  // choose the appropriate layout, e.g. based on logger name
  if(e.getLoggerName().startsWith("com.example.")) {
   return layout1.format(e);
  } else {
   return layout2.format(e);
  }
 }

}

代码示例来源:origin: org.apache.flume.flume-ng-clients/flume-ng-log4jappender

rpcClient = RpcClientFactory.getInstance(props);
if (layout != null) {
 layout.activateOptions();

代码示例来源:origin: org.apache.flume.flume-ng-clients/flume-ng-log4jappender

/**
 * Activate the options set using <tt>setHosts()</tt>, <tt>setSelector</tt>
 * and <tt>setMaxBackoff</tt>
 *
 * @throws FlumeException
 *           if the LoadBalancingRpcClient cannot be instantiated.
 */
@Override
public void activateOptions() throws FlumeException {
 try {
  final Properties properties = getProperties(hosts, selector, maxBackoff, getTimeout());
  rpcClient = RpcClientFactory.getInstance(properties);
  if (layout != null) {
   layout.activateOptions();
  }
  configured = true;
 } catch (Exception e) {
  String errormsg = "RPC client creation failed! " + e.getMessage();
  LogLog.error(errormsg);
  if (getUnsafeMode()) {
   return;
  }
  throw new FlumeException(e);
 }
 initializeClientAddress();
}

相关文章