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


Java RendererSupport类代码示例

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


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

示例1: getRenderedMessage

import org.apache.log4j.spi.RendererSupport; //导入依赖的package包/类
public
String getRenderedMessage() {
   if(renderedMessage == null && message != null) {
     if(message instanceof String)
renderedMessage = (String) message;
     else {
LoggerRepository repository = logger.getLoggerRepository();

if(repository instanceof RendererSupport) {
  RendererSupport rs = (RendererSupport) repository;
  renderedMessage= rs.getRendererMap().findAndRender(message);
} else {
  renderedMessage = message.toString();
}
     }
   }
   return renderedMessage;
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:19,代码来源:LogEvent.java

示例2: addRenderer

import org.apache.log4j.spi.RendererSupport; //导入依赖的package包/类
/**
    Add a renderer to a hierarchy passed as parameter.
 */
 static
 public
 void addRenderer(RendererSupport repository, String renderedClassName,
	   String renderingClassName) {
   LogLog.debug("Rendering class: ["+renderingClassName+"], Rendered class: ["+
	 renderedClassName+"].");
   ObjectRenderer renderer = (ObjectRenderer)
            OptionConverter.instantiateByClassName(renderingClassName,
					    ObjectRenderer.class,
					    null);
   if(renderer == null) {
     LogLog.error("Could not instantiate renderer ["+renderingClassName+"].");
     return;
   } else {
     try {
Class renderedClass = Loader.loadClass(renderedClassName);
repository.setRenderer(renderedClass, renderer);
     } catch(ClassNotFoundException e) {
LogLog.error("Could not find class ["+renderedClassName+"].", e);
     }
   }
 }
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:26,代码来源:RendererMap.java

示例3: parseCatsAndRenderers

import org.apache.log4j.spi.RendererSupport; //导入依赖的package包/类
/**
    Parse non-root elements, such non-root categories and renderers.
 */
 protected
 void parseCatsAndRenderers(Properties props, LoggerRepository hierarchy) {
   Enumeration enumeration = props.propertyNames();
   while(enumeration.hasMoreElements()) {
     String key = (String) enumeration.nextElement();
     if(key.startsWith(CATEGORY_PREFIX) || key.startsWith(LOGGER_PREFIX)) {
String loggerName = null;
if(key.startsWith(CATEGORY_PREFIX)) {
  loggerName = key.substring(CATEGORY_PREFIX.length());
} else if(key.startsWith(LOGGER_PREFIX)) {
  loggerName = key.substring(LOGGER_PREFIX.length());
}
String value =  OptionConverter.findAndSubst(key, props);
Logger logger = hierarchy.getLogger(loggerName, loggerFactory);
synchronized(logger) {
  parseCategory(props, logger, key, loggerName, value);
  parseAdditivityForLogger(props, logger, loggerName);
}
     } else if(key.startsWith(RENDERER_PREFIX)) {
String renderedClass = key.substring(RENDERER_PREFIX.length());
String renderingClass = OptionConverter.findAndSubst(key, props);
if(hierarchy instanceof RendererSupport) {
  RendererMap.addRenderer((RendererSupport) hierarchy, renderedClass,
			  renderingClass);
}
     }
   }
 }
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:32,代码来源:PropertyConfigurator.java

示例4: parseRenderer

import org.apache.log4j.spi.RendererSupport; //导入依赖的package包/类
protected 
void parseRenderer(Element element) {
  String renderingClass = subst(element.getAttribute(RENDERING_CLASS_ATTR));
  String renderedClass = subst(element.getAttribute(RENDERED_CLASS_ATTR));
  if(repository instanceof RendererSupport) {
    RendererMap.addRenderer((RendererSupport) repository, renderedClass, 
	      renderingClass);
  }
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:10,代码来源:DOMConfigurator.java

示例5: parseCatsAndRenderers

import org.apache.log4j.spi.RendererSupport; //导入依赖的package包/类
/**
    Parse non-root elements, such non-root categories and renderers.
 */
 protected
 void parseCatsAndRenderers(Properties props, LoggerRepository hierarchy) {
   Enumeration enumeration = props.propertyNames();
   while(enumeration.hasMoreElements()) {
     String key = (String) enumeration.nextElement();
     if(key.startsWith(CATEGORY_PREFIX) || key.startsWith(LOGGER_PREFIX)) {
String loggerName = null;
if(key.startsWith(CATEGORY_PREFIX)) {
  loggerName = key.substring(CATEGORY_PREFIX.length());
} else if(key.startsWith(LOGGER_PREFIX)) {
  loggerName = key.substring(LOGGER_PREFIX.length());
}
String value =  OptionConverter.findAndSubst(key, props);
Logger logger = hierarchy.getLogger(loggerName, loggerFactory);
synchronized(logger) {
  parseCategory(props, logger, key, loggerName, value);
  parseAdditivityForLogger(props, logger, loggerName);
}
     } else if(key.startsWith(RENDERER_PREFIX)) {
String renderedClass = key.substring(RENDERER_PREFIX.length());
String renderingClass = OptionConverter.findAndSubst(key, props);
if(hierarchy instanceof RendererSupport) {
  RendererMap.addRenderer((RendererSupport) hierarchy, renderedClass,
			  renderingClass);
}
     } else if (key.equals(THROWABLE_RENDERER_PREFIX)) {
         if (hierarchy instanceof ThrowableRendererSupport) {
           ThrowableRenderer tr = (ThrowableRenderer)
                 OptionConverter.instantiateByKey(props,
                         THROWABLE_RENDERER_PREFIX,
                         org.apache.log4j.spi.ThrowableRenderer.class,
                         null);
           if(tr == null) {
               LogLog.error(
                   "Could not instantiate throwableRenderer.");
           } else {
               PropertySetter setter = new PropertySetter(tr);
               setter.setProperties(props, THROWABLE_RENDERER_PREFIX + ".");
               ((ThrowableRendererSupport) hierarchy).setThrowableRenderer(tr);

           }
         }
     }
   }
 }
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:49,代码来源:PropertyConfigurator.java


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