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


Java ILogNode.isTraceEnabled方法代码示例

本文整理汇总了Java中com.mendix.logging.ILogNode.isTraceEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java ILogNode.isTraceEnabled方法的具体用法?Java ILogNode.isTraceEnabled怎么用?Java ILogNode.isTraceEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.mendix.logging.ILogNode的用法示例。


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

示例1: publish

import com.mendix.logging.ILogNode; //导入方法依赖的package包/类
@Override
public void publish(LogRecord record)
{
	/*
	  @see java.util.logging.Level;
	  public static final Level OFF = new Level("OFF", 2147483647, defaultBundle);
	  public static final Level SEVERE = new Level("SEVERE", 1000, defaultBundle);
	  public static final Level WARNING = new Level("WARNING", 900, defaultBundle);
	  public static final Level INFO = new Level("INFO", 800, defaultBundle);
	  public static final Level CONFIG = new Level("CONFIG", 700, defaultBundle);
	  public static final Level FINE = new Level("FINE", 500, defaultBundle);
	  public static final Level FINER = new Level("FINER", 400, defaultBundle);
	  public static final Level FINEST = new Level("FINEST", 300, defaultBundle);
	  public static final Level ALL = new Level("ALL", -2147483648, defaultBundle);
	 */
	if (record.getLevel() == Level.OFF || record.getLevel() == Level.ALL) //These loglevels should not be used inside a log record
		return;
	
	ILogNode logNode = Core.getLogger(record.getLoggerName());
	int loglevel = record.getLevel().intValue();
	
	if (loglevel < Level.INFO.intValue() && !logNode.isDebugEnabled())
		return;
	if (loglevel < Level.FINER.intValue() && !logNode.isTraceEnabled())
		return;
		
	Throwable ex = record.getThrown();
	if (loglevel < Level.FINER.intValue())
		logNode.trace(record.getMessage(), ex);
	else if (loglevel < Level.INFO.intValue())
		logNode.debug(record.getMessage(), ex);
	else if (ex != null)
		logNode.error(record.getMessage(), ex);
	else
		logNode.info(record.getMessage());
}
 
开发者ID:mendix,项目名称:IBM-Watson-Connector-Suite,代码行数:37,代码来源:CommonsLoggingListener.java

示例2: overlayPdf

import com.mendix.logging.ILogNode; //导入方法依赖的package包/类
/**
 * Overlay a generated PDF document with another PDF (containing the company stationary for example)
 * @param context
 * @param generatedDocumentMendixObject The document to overlay
 * @param overlayMendixObject The document containing the overlay
 * @return boolean
 * @throws IOException
 * @throws COSVisitorException
 */
public static boolean overlayPdf(IContext context, IMendixObject generatedDocumentMendixObject, IMendixObject overlayMendixObject) throws IOException, COSVisitorException {
	
	ILogNode logger = Core.getLogger("OverlayPdf"); 
	logger.trace("Overlay PDF start, retrieve overlay PDF");
	PDDocument overlayDoc = PDDocument.load(Core.getFileDocumentContent(context, overlayMendixObject));
	int overlayPageCount = overlayDoc.getNumberOfPages();
	PDPage lastOverlayPage = (PDPage)overlayDoc.getDocumentCatalog().getAllPages().get(overlayPageCount - 1);

	logger.trace("Retrieve generated document");
	PDDocument offerteDoc = PDDocument.load(Core.getFileDocumentContent(context, generatedDocumentMendixObject));

	int pageCount = offerteDoc.getNumberOfPages();
	if (logger.isTraceEnabled()) {
		logger.trace("Number of pages in overlay: " + overlayPageCount + ", in generated document: " + pageCount);						
	}
	if (pageCount > overlayPageCount) {
		logger.trace("Duplicate last overlay page to match number of pages");
		for (int i = overlayPageCount; i < pageCount; i++) {
			overlayDoc.importPage(lastOverlayPage);
		}
	} else if (overlayPageCount > pageCount) {
		logger.trace("Delete unnecessary pages from the overlay to match number of pages");
		for (int i = pageCount; i < overlayPageCount; i++) {
			overlayDoc.removePage(i);
		}
	}
			
	logger.trace("Perform overlay");
	Overlay overlay = new Overlay();
	overlay.overlay(offerteDoc,overlayDoc);
	
	logger.trace("Save result in output stream");
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	overlayDoc.save(baos);
	
	logger.trace("Duplicate result in input stream");
	InputStream overlayedContent = new ByteArrayInputStream(baos.toByteArray());
	
	logger.trace("Store result in original document");
	Core.storeFileDocumentContent(context, generatedDocumentMendixObject, overlayedContent);
	
	logger.trace("Close PDFs");
	overlayDoc.close();
	offerteDoc.close();
	
	logger.trace("Overlay PDF end");
	return true;
	
}
 
开发者ID:appronto,项目名称:RedisConnector,代码行数:59,代码来源:Misc.java


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