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

x33g5p2x  于2022-01-15 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(185)

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

Appender.getLayout介绍

[英]Returns this appenders layout.
[中]返回此附加器布局。

代码示例

代码示例来源:origin: log4j/log4j

public
ObjectName preRegister(MBeanServer server, ObjectName name) {
 cat.debug("preRegister called. Server="+server+ ", name="+name);
 this.server = server;
 registerLayoutMBean(appender.getLayout());
 return name;
}

代码示例来源:origin: log4j/log4j

if (app.getLayout() != null) {
 printOptions(out, app.getLayout(), "log4j.appender."+name+".layout");

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

private WriterAppender getConsoleAppender(ByteArrayOutputStream os, Level level) {
  String loggingPattern = ((PatternLayout) Logger.getRootLogger().getAppender("CONSOLE").getLayout()).getConversionPattern();
  WriterAppender appender = new WriterAppender(new PatternLayout(loggingPattern), os);
  appender.setThreshold(level);
  return appender;
}

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

LogCapturer(org.apache.log4j.Logger logger) {
 this.logger = logger;
 Appender defaultAppender = org.apache.log4j.Logger.getRootLogger().getAppender("stdout");
 if (defaultAppender == null) {
  defaultAppender = org.apache.log4j.Logger.getRootLogger().getAppender("console");
 }
 final Layout layout = (defaultAppender == null) ? new PatternLayout() :
   defaultAppender.getLayout();
 this.appender = new WriterAppender(layout, sw);
 this.logger.addAppender(this.appender);
}

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

.getLayout();
ByteArrayOutputStream os = new ByteArrayOutputStream();
WriterAppender appender = new WriterAppender(layout, os);

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

public
ObjectName preRegister(MBeanServer server, ObjectName name) {
 cat.debug("preRegister called. Server="+server+ ", name="+name);
 this.server = server;
 registerLayoutMBean(appender.getLayout());
 return name;
}

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

if (app.getLayout() != null) {
 printOptions(out, app.getLayout(), "log4j.appender."+name+".layout");

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

if (app.getLayout() != null) {
 printOptions(out, app.getLayout(), "log4j.appender."+name+".layout");

代码示例来源:origin: org.apache.hadoop/hadoop-mapreduce-client-core

Logger.getRootLogger().getAppender("stdout").getLayout();
ByteArrayOutputStream os = new ByteArrayOutputStream();
WriterAppender appender = new WriterAppender(layout, os);

代码示例来源:origin: com.atlassian.jira/jira-core

public PatternLayout getSystemPatternLayout()
  {
    Appender filelog = Logger.getRootLogger().getAppender("filelog");
    if (filelog != null && filelog instanceof PatternLayout)
    {
      return (PatternLayout) filelog.getLayout();
    }
    return new PatternLayout(DEFAULT_PATTERN);
  }
}

代码示例来源:origin: org.apache.activemq/activemq-all

public
ObjectName preRegister(MBeanServer server, ObjectName name) {
 cat.debug("preRegister called. Server="+server+ ", name="+name);
 this.server = server;
 registerLayoutMBean(appender.getLayout());
 return name;
}

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

public
ObjectName preRegister(MBeanServer server, ObjectName name) {
 cat.debug("preRegister called. Server="+server+ ", name="+name);
 this.server = server;
 registerLayoutMBean(appender.getLayout());
 return name;
}

代码示例来源:origin: matsim-org/matsim

/**
 * Remove the line break form the logger pattern. Subsequent writes to stdout are printed to the same line.
 */
public static void disableNewLine() {
  Appender appender = Logger.getRootLogger().getAppender("stdout");
  defaultLayout = (PatternLayout)appender.getLayout();
  PatternLayout newLayout = new PatternLayout(defaultLayout.getConversionPattern().replace("%n",""));
  appender.setLayout(newLayout);
}

代码示例来源:origin: org.apache.log4j/com.springsource.org.apache.log4j

public
ObjectName preRegister(MBeanServer server, ObjectName name) {
 cat.debug("preRegister called. Server="+server+ ", name="+name);
 this.server = server;
 registerLayoutMBean(appender.getLayout());
 return name;
}

代码示例来源:origin: apache-log4j/log4j

public
ObjectName preRegister(MBeanServer server, ObjectName name) {
 cat.debug("preRegister called. Server="+server+ ", name="+name);
 this.server = server;
 registerLayoutMBean(appender.getLayout());
 return name;
}

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

public
ObjectName preRegister(MBeanServer server, ObjectName name) {
 cat.debug("preRegister called. Server="+server+ ", name="+name);
 this.server = server;
 registerLayoutMBean(appender.getLayout());
 return name;
}

代码示例来源:origin: org.apache/log4j

public
ObjectName preRegister(MBeanServer server, ObjectName name) {
 cat.debug("preRegister called. Server="+server+ ", name="+name);
 this.server = server;
 registerLayoutMBean(appender.getLayout());
 return name;
}

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

logger.info("hey!");

LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
Configuration conf = ctx.getConfiguration();
Appender console = conf.getAppenders().get("console");   // <-- your appender name
PatternLayout layout = (PatternLayout) console.getLayout();

layout.setConversionPattern("%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n");

ctx.updateLoggers(conf);

logger.info("hey!");

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

private LogCapturer(Logger logger) {
 this.logger = logger;
 Layout layout = Logger.getRootLogger().getAppender("stdout").getLayout();
 WriterAppender wa = new WriterAppender(layout, sw);
 logger.addAppender(wa);
}

代码示例来源:origin: org.apache.hbase/hbase-server

LogCapturer(org.apache.log4j.Logger logger) {
 this.logger = logger;
 Appender defaultAppender = org.apache.log4j.Logger.getRootLogger().getAppender("stdout");
 if (defaultAppender == null) {
  defaultAppender = org.apache.log4j.Logger.getRootLogger().getAppender("console");
 }
 final Layout layout = (defaultAppender == null) ? new PatternLayout() :
   defaultAppender.getLayout();
 this.appender = new WriterAppender(layout, sw);
 this.logger.addAppender(this.appender);
}

相关文章