當前位置: 首頁>>代碼示例>>Java>>正文


Java Logger.trace方法代碼示例

本文整理匯總了Java中org.jboss.logging.Logger.trace方法的典型用法代碼示例。如果您正苦於以下問題:Java Logger.trace方法的具體用法?Java Logger.trace怎麽用?Java Logger.trace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jboss.logging.Logger的用法示例。


在下文中一共展示了Logger.trace方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: debugFrame

import org.jboss.logging.Logger; //導入方法依賴的package包/類
public static void debugFrame(Logger logger, String message, ByteBuf byteIn) {
   if (logger.isTraceEnabled()) {
      int location = byteIn.readerIndex();
      // debugging
      byte[] frame = new byte[byteIn.writerIndex()];
      byteIn.readBytes(frame);

      try {
         logger.trace(message + "\n" + ByteUtil.formatGroup(ByteUtil.bytesToHex(frame), 8, 16));
      } catch (Exception e) {
         logger.warn(e.getMessage(), e);
      }

      byteIn.readerIndex(location);
   }
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:17,代碼來源:ByteUtil.java

示例2: main

import org.jboss.logging.Logger; //導入方法依賴的package包/類
public static void main(String[] args) throws MalformedURLException {

        // 2. Specify the alternate log manager as a system property
        System.setProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager");
        
        // 3. Specify a system property point to logging.properties(optional, if not set, a configuration locator will find 'logging.properties' in the class path)
        String propUrl = JBossLoggingExample.class.getClassLoader().getResource("logging.properties").toString();
        System.out.println(propUrl);
        System.setProperty("logging.configuration", propUrl);
        
        // 4. Initialize a Logger
        Logger logger = Logger.getLogger(JBossLoggingExample.class);
        
        // 5. logging the message
        logger.trace("TRACE Message");
        logger.debug("DEBUG Message");
        logger.info("INFO Message");
        logger.warn("WARN Message");
        logger.error("Error Message");
        logger.fatal("FATAL Message");
    }
 
開發者ID:jbosschina,項目名稱:wildfly-dev-cookbook,代碼行數:22,代碼來源:JBossLoggingExample.java

示例3: main

import org.jboss.logging.Logger; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException {

        // 2. Specify the alternate log manager as a system property
        System.setProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager");
        
        // 3. Configure Programmtically
        String logLevel = "TRACE";
        String logFile = "target/jboss-logging-programmtically.log";
        PropertyConfigurator configurator = new PropertyConfigurator();
        configurator.configure(createLogManagerConfig(logLevel, logFile));
        
        // 4. Initialize a Logger
        Logger logger = Logger.getLogger(JBossLoggingExample.class);
        
        // 5. logging the message
        logger.trace("TRACE Message");
        logger.debug("DEBUG Message");
        logger.info("INFO Message");
        logger.warn("WARN Message");
        logger.error("Error Message");
        logger.fatal("FATAL Message");
        
    }
 
開發者ID:jbosschina,項目名稱:wildfly-dev-cookbook,代碼行數:24,代碼來源:JBossLoggingProgrammticalExample.java

示例4: testCustomCategory

import org.jboss.logging.Logger; //導入方法依賴的package包/類
@Test
public void testCustomCategory() {
    Logger logger = Logger.getLogger("custom.category");

    logger.info("gouda info");
    logger.debug("gouda debug");
    logger.trace("gouda trace");

    assertFalse(logger.isTraceEnabled());
    assertTrue(logger.isDebugEnabled());
    assertTrue(logger.isInfoEnabled());
}
 
開發者ID:wildfly-swarm,項目名稱:wildfly-swarm,代碼行數:13,代碼來源:ArqLoggingLevelsTest.java

示例5: testCustomCategoryChildren

import org.jboss.logging.Logger; //導入方法依賴的package包/類
@Test
public void testCustomCategoryChildren() {
    Logger logger = Logger.getLogger("custom.category.children.Something");

    logger.info("gouda info");
    logger.debug("gouda debug");
    logger.trace("gouda trace");

    assertFalse(logger.isTraceEnabled());
    assertTrue(logger.isDebugEnabled());
    assertTrue(logger.isInfoEnabled());
}
 
開發者ID:wildfly-swarm,項目名稱:wildfly-swarm,代碼行數:13,代碼來源:ArqLoggingLevelsTest.java

示例6: testRoot

import org.jboss.logging.Logger; //導入方法依賴的package包/類
@Test
public void testRoot() {
    Logger logger = Logger.getLogger("");

    logger.info("gouda info");
    logger.debug("gouda debug");
    logger.trace("gouda trace");

    assertTrue(logger.isTraceEnabled());
    assertTrue(logger.isDebugEnabled());
    assertTrue(logger.isInfoEnabled());
}
 
開發者ID:wildfly-swarm,項目名稱:wildfly-swarm,代碼行數:13,代碼來源:ArqLoggingLevelsTest.java

示例7: loadProperties

import org.jboss.logging.Logger; //導入方法依賴的package包/類
/**
 * Utility method which loads the given properties file and returns a
 * Properties object containing the key,value pairs in that file. The
 * properties files should be in the class path as this method looks to the
 * thread context class loader (TCL) to locate the resource. If the TCL is a
 * URLClassLoader the findResource(String) method is first tried. If this
 * fails or the TCL is not a URLClassLoader getResource(String) is tried. If
 * not, an absolute path is tried.
 * 
 * @param propertiesName
 *            - the name of the properties file resource
 * @param log
 *            - the logger used for trace level messages
 * @return the loaded properties file if found
 * @exception java.io.IOException
 *                thrown if the properties file cannot be found or loaded
 */
static Properties loadProperties(String propertiesName, Logger log) throws IOException {
	ClassLoader loader = ResourceActions.getContextClassLoader();
	URL url = null;
	// First check for local visibility via a URLClassLoader.findResource
	if (loader instanceof URLClassLoader) {
		URLClassLoader ucl = (URLClassLoader) loader;
		url = ResourceActions.findResource(ucl, propertiesName);
		log.trace("findResource: " + url); //$NON-NLS-1$
	}
	if (url == null)
		url = loader.getResource(propertiesName);
	if (url == null) {
		url = new URL(propertiesName);
	}

	log.trace("Properties file=" + url); //$NON-NLS-1$

	Properties bundle = new Properties();
	InputStream is = null;
	try {
		is = ResourceActions.openStream(url);
	} catch (PrivilegedActionException e) {
		throw new IOException(e.getLocalizedMessage());
	}
	if (is != null) {
		bundle.load(is);
		is.close();
	} else {
		throw new IOException("Properties file " + propertiesName + " not available");//$NON-NLS-1$ //$NON-NLS-2$
	}
	log.debug("Loaded properties, users=" + bundle.keySet());//$NON-NLS-1$
	return bundle;
}
 
開發者ID:kenweezy,項目名稱:teiid,代碼行數:51,代碼來源:Util.java

示例8: traceLog

import org.jboss.logging.Logger; //導入方法依賴的package包/類
/**
 * Trace log header keys and values.
 * @param logger The Logger
 * @param headers The header map
 */
public static void traceLog(final Logger logger, final Map<String, List<String>> headers) {
    for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
        String name = entry.getKey();
        List<String> values = entry.getValue();
        for (String value : values) {
            logger.trace(name + " = " + value);
        }
    }
}
 
開發者ID:jboss-switchyard,項目名稱:switchyard,代碼行數:15,代碼來源:RESTEasyProxy.java


注:本文中的org.jboss.logging.Logger.trace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。