当前位置: 首页>>代码示例>>Java>>正文


Java PatternConverter类代码示例

本文整理汇总了Java中org.apache.log4j.helpers.PatternConverter的典型用法代码示例。如果您正苦于以下问题:Java PatternConverter类的具体用法?Java PatternConverter怎么用?Java PatternConverter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PatternConverter类属于org.apache.log4j.helpers包,在下文中一共展示了PatternConverter类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: format

import org.apache.log4j.helpers.PatternConverter; //导入依赖的package包/类
/**
   Produces a formatted string as specified by the conversion pattern.
*/
public String format(LoggingEvent event) {
  // Reset working stringbuffer
  if(sbuf.capacity() > MAX_CAPACITY) {
    sbuf = new StringBuffer(BUF_SIZE);
  } else {
    sbuf.setLength(0);
  }

  PatternConverter c = head;

  while(c != null) {
    c.format(sbuf, event);
    c = c.next;
  }
  return sbuf.toString();
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:20,代码来源:PatternLayout.java

示例2: finalizeConverter

import org.apache.log4j.helpers.PatternConverter; //导入依赖的package包/类
@Override
protected void finalizeConverter(char c) {
    PatternConverter pc = null;

    switch (c) {
        case 'H':
            pc = new HeaderPatternConverter(formattingInfo);
            currentLiteral.setLength(0);
            break;
    }

    if (pc != null) {
        addConverter(pc);
    } else {
        super.finalizeConverter(c);
    }
}
 
开发者ID:primecloud-controller-org,项目名称:primecloud-controller,代码行数:18,代码来源:ExtendedPatternParser.java

示例3: finalizeConverter

import org.apache.log4j.helpers.PatternConverter; //导入依赖的package包/类
/**
 * @param c
 * @see org.apache.log4j.helpers.PatternParser#finalizeConverter(char)
 */
@Override
protected void finalizeConverter(final char c)
{
	switch (c)
	{
		case 'm':
		{
			final PatternConverter pc = new EscapedMessagePatternConverter(
					formattingInfo);
			// LogLog.debug("MESSAGE converter.");
			// formattingInfo.dump();
			currentLiteral.setLength(0);
			addConverter(pc);
			break;
		}

		default:
		{
			super.finalizeConverter(c);
			break;
		}
	}
}
 
开发者ID:openfurther,项目名称:further-open-core,代码行数:28,代码来源:EscapedPatternLayout.java

示例4: format

import org.apache.log4j.helpers.PatternConverter; //导入依赖的package包/类
/**
   Produces a formatted string as specified by the conversion pattern.
 */
public String format(LoggingEvent event) {
	// Reset working stringbuffer
	if(sbuf.capacity() > MAX_CAPACITY) {
		sbuf = new StringBuffer(BUF_SIZE);
	} else {
		sbuf.setLength(0);
	}

	PatternConverter c = head;

	while(c != null) {
		c.format(sbuf, event);
		c = c.next;
	}
	return sbuf.toString();
}
 
开发者ID:OurGrid,项目名称:commune,代码行数:20,代码来源:SyncPatternLayout.java

示例5: format

import org.apache.log4j.helpers.PatternConverter; //导入依赖的package包/类
/**
 * Formats a logging event to a writer.
 * 
 * @param event
 *            logging event to be formatted.
 */
public String format(final LoggingEvent event) {
	final StringBuffer buf = new StringBuffer();
	for (PatternConverter c = head; c != null; c = c.next) {
		c.format(buf, event);
	}
	return buf.toString();
}
 
开发者ID:foundation-runtime,项目名称:logging,代码行数:14,代码来源:FoundationLoggingPatternLayout.java

示例6: format

import org.apache.log4j.helpers.PatternConverter; //导入依赖的package包/类
/**
 *  Formats a logging event to a writer.
 * @param event logging event to be formatted.
*/
public String format(final LoggingEvent event) {
    StringBuffer buf = new StringBuffer();
    for(PatternConverter c = head;
        c != null;
        c = c.next) {
        c.format(buf, event);
    }
    return buf.toString();
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:14,代码来源:EnhancedPatternLayout.java

示例7: FoundationLoggingPatternConverter

import org.apache.log4j.helpers.PatternConverter; //导入依赖的package包/类
/**
 * Create a new instance.
 * 
 * @param pattern
 *            pattern, may not be null.
 */

public FoundationLoggingPatternConverter(final String pattern) {
	super();
	next = null;
	handlesExceptions = false;

	final List<PatternConverter> converters = new ArrayList<PatternConverter>();
	final List<FormattingInfo> fields = new ArrayList<FormattingInfo>();
	@SuppressWarnings("unchecked")
	final Map converterRegistry = null;

	@SuppressWarnings("unchecked")
	final Map<String, Class<? extends org.apache.log4j.pattern.PatternConverter>> patternLayoutRules = PatternParser.getPatternLayoutRules();
	final Map<String, Class<? extends org.apache.log4j.pattern.PatternConverter>> newPatternLayoutRules = new HashMap<String, Class<? extends org.apache.log4j.pattern.PatternConverter>>();
	newPatternLayoutRules.putAll(patternLayoutRules);
	newPatternLayoutRules.put("throwable", FoundationLoggingThrowableInformationPatternConverter.class);
	newPatternLayoutRules.put("pm", FoundationLoggingMessagePatternConverter.class);
	newPatternLayoutRules.put("sl", FoundationLoggingStructuredMessageConverter.class);
	newPatternLayoutRules.put("prettymessage", FoundationLoggingMessagePatternConverter.class);
	newPatternLayoutRules.put("errorcode", FoundationLoggingErrorCodePatternConverter.class);
	newPatternLayoutRules.put("audit", FoundationLoggingAuditPatternConverter.class);
	newPatternLayoutRules.put("u", FoundationLoggingUserFieldPatternConverter.class);
	newPatternLayoutRules.put("host", FoundationLoggingHostPatternConverter.class);
	newPatternLayoutRules.put("compInstallPath", FoundationLoggingCompInstPathPatternConverter.class);
	newPatternLayoutRules.put("compVersion", FoundationLoggingCompVersionPatternConverter.class);
	newPatternLayoutRules.put("compName", FoundationLoggingCompNamePatternConverter.class);
	newPatternLayoutRules.put("compInstanceName", FoundationLoggingCompInstNamePatternConverter.class);

	PatternParser.parse(pattern, converters, fields, converterRegistry, newPatternLayoutRules);

	patternConverters = new LoggingEventPatternConverter[converters.size()];
	patternFields = new FormattingInfo[converters.size()];

	int index = 0;
	final Iterator<PatternConverter> converterIter = converters.iterator();
	final Iterator<FormattingInfo> fieldIter = fields.iterator();

	while (converterIter.hasNext()) {
		final Object converter = converterIter.next();

		if (converter instanceof LoggingEventPatternConverter) {
			patternConverters[index] = (LoggingEventPatternConverter) converter;
			handlesExceptions |= patternConverters[index].handlesThrowable();
		} else {
			patternConverters[index] = new org.apache.log4j.pattern.LiteralPatternConverter("");
		}

		if (fieldIter.hasNext()) {
			patternFields[index] = fieldIter.next();
		} else {
			patternFields[index] = FormattingInfo.getDefault();
		}

		index++;
	}
}
 
开发者ID:foundation-runtime,项目名称:logging,代码行数:63,代码来源:FoundationLoggingPatternConverter.java


注:本文中的org.apache.log4j.helpers.PatternConverter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。