本文整理汇总了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);
}
}
示例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");
}
示例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");
}
示例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());
}
示例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());
}
示例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());
}
示例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;
}
示例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);
}
}
}