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


Java Logger.getLogger方法代码示例

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


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

示例1: configure

import org.jboss.logging.Logger; //导入方法依赖的package包/类
/**
 * <p>
 * Provide a hook for lazy configuration of this <code>Digester</code>
 * instance.  The default implementation does nothing, but subclasses
 * can override as needed.
 * </p>
 *
 * <p>
 * <strong>Note</strong> This method may be called more than once.
 * Once only initialization code should be placed in {@link #initialize}
 * or the code should take responsibility by checking and setting the 
 * {@link #configured} flag.
 * </p>
 */
protected void configure() {

    // Do not configure more than once
    if (configured) {
        return;
    }

    log = Logger.getLogger("org.apache.commons.digester.Digester");
    saxLog = Logger.getLogger("org.apache.commons.digester.Digester.sax");

    // Perform lazy configuration as needed
    initialize(); // call hook method for subclasses that want to be initialized once only
    // Nothing else required by default

    // Set the configuration flag to avoid repeating
    configured = true;

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:33,代码来源:Digester.java

示例2: resolveEntity

import org.jboss.logging.Logger; //导入方法依赖的package包/类
public InputSource resolveEntity(String publicId, String systemId)
        throws SAXException {
    for (int i = 0; i < Constants.CACHED_DTD_PUBLIC_IDS.length; i++) {
        String cachedDtdPublicId = Constants.CACHED_DTD_PUBLIC_IDS[i];
        if (cachedDtdPublicId.equals(publicId)) {
            String resourcePath = Constants.CACHED_DTD_RESOURCE_PATHS[i];
            InputStream input = this.getClass().getResourceAsStream(
                    resourcePath);
            if (input == null) {
                throw new SAXException(Localizer.getMessage(
                        "jsp.error.internal.filenotfound", resourcePath));
            }
            InputSource isrc = new InputSource(input);
            return isrc;
        }
    }
    Logger log = Logger.getLogger(MyEntityResolver.class);
    if (log.isDebugEnabled())
        log.debug("Resolve entity failed" + publicId + " " + systemId);
    log.error(Localizer.getMessage("jsp.error.parse.xml.invalidPublicId",
            publicId));
    return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:ParserUtils.java

示例3: testNothing

import org.jboss.logging.Logger; //导入方法依赖的package包/类
@Test
public void testNothing() {
    Logger gouda = Logger.getLogger( "cheese.gouda" );

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

    assertTrue( gouda.isTraceEnabled() );
    assertTrue( gouda.isDebugEnabled() );
    assertTrue( gouda.isInfoEnabled() );

    Logger cheddar = Logger.getLogger( "cheese.cheddar" );

    cheddar.info( "cheddar info" );
    cheddar.debug( "cheddar debug" );

    assertFalse( cheddar.isTraceEnabled() );
    assertFalse( cheddar.isDebugEnabled() );
    assertFalse( cheddar.isInfoEnabled() );
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:21,代码来源:LoggingArquillianTest.java

示例4: doLogging

import org.jboss.logging.Logger; //导入方法依赖的package包/类
@Test
public void doLogging() throws FileNotFoundException {
    String message = "testing: " + UUID.randomUUID().toString();
    Logger logger = Logger.getLogger("br.org.sistemafieg.cliente");
    logger.info(message);
    assertTrue("File not found: " + logFile, new File(logFile).exists());

    BufferedReader reader = new BufferedReader(new FileReader(logFile));
    List<String> lines = reader.lines().collect(Collectors.toList());

    boolean found = false;

    for (String line : lines) {
        if (line.contains(message)) {
            found = true;
            break;
        }
    }

    assertTrue("Expected message " + message, found);


}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:24,代码来源:SWARM553Test.java

示例5: testNothing

import org.jboss.logging.Logger; //导入方法依赖的package包/类
@Test
public void testNothing() {
    Logger gouda = Logger.getLogger( "cheese.gouda" );

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

    assertFalse( gouda.isTraceEnabled() );
    assertFalse( gouda.isDebugEnabled() );
    assertTrue( gouda.isInfoEnabled() );

    Logger cheddar = Logger.getLogger( "cheese.cheddar" );

    cheddar.info( "cheddar info" );
    cheddar.debug( "cheddar debug" );

    assertFalse( cheddar.isTraceEnabled() );
    assertFalse( cheddar.isDebugEnabled() );
    assertTrue( cheddar.isInfoEnabled() );
}
 
开发者ID:wildfly-swarm,项目名称:wildfly-swarm,代码行数:21,代码来源:LoggingArquillianDefaultTest.java

示例6: 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

示例7: 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

示例8: getLogger

import org.jboss.logging.Logger; //导入方法依赖的package包/类
/**
 * Return the Logger with which this Container is associated.  If there is
 * no associated Logger, return the Logger associated with our parent
 * Container (if any); otherwise return <code>null</code>.
 */
public Logger getLogger() {

    if (logger != null)
        return (logger);
    logger = Logger.getLogger(logName());
    return (logger);

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:ContainerBase.java

示例9: warning

import org.jboss.logging.Logger; //导入方法依赖的package包/类
public void warning(SAXParseException ex) throws SAXException {
    Logger log = Logger.getLogger(MyErrorHandler.class);
    if (log.isDebugEnabled())
        log.debug("ParserUtils: warning ", ex);
    // We ignore warnings
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:7,代码来源:ParserUtils.java

示例10: handleCustomLog

import org.jboss.logging.Logger; //导入方法依赖的package包/类
private void handleCustomLog(HttpServerExchange exchange, Throwable t, Logger.Level level, Logger.Level stackTraceLevel, String category) {
    BasicLogger logger = UndertowLogger.REQUEST_LOGGER;
    if (!category.isEmpty()) {
        logger = Logger.getLogger(category);
    }
    boolean stackTrace = true;
    if (stackTraceLevel.ordinal() > level.ordinal()) {
        if (!logger.isEnabled(stackTraceLevel)) {
            stackTrace = false;
        }
    }
    if (stackTrace) {
        logger.logf(level, t, "Exception handling request to %s", exchange.getRequestURI());
    } else {
        logger.logf(level, "Exception handling request to %s: %s", exchange.getRequestURI(), t.getMessage());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:LoggingExceptionHandler.java

示例11: 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

示例12: 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

示例13: 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

示例14: TaskExecutionImpl

import org.jboss.logging.Logger; //导入方法依赖的package包/类
private TaskExecutionImpl(ServerMigrationTask task, TaskExecutionImpl parent, ServerMigrationContext serverMigrationContext) {
    this.task = task;
    this.parent = parent;
    this.serverMigrationContext = serverMigrationContext;
    this.children = new ArrayList<>();
    taskNumber = parent == null ? "1" : parent.getTaskNumber() +":" + parent.taskCounter.incrementAndGet();
    this.logger = Logger.getLogger(ServerMigrationTask.class.getName()+'#'+taskNumber);
    this.taskPath = new ServerMigrationTaskPath(task.getName(), parent != null ? parent.getTaskPath() : null);
}
 
开发者ID:emmartins,项目名称:wildfly-server-migration,代码行数:10,代码来源:TaskExecutionImpl.java

示例15: getLogger

import org.jboss.logging.Logger; //导入方法依赖的package包/类
/**
    * Get the logger for the given context.
    * @param context
    * @return
    */
private Logger getLogger(String context) {
	Logger logger = loggers.get(context);
	if (logger == null) {
		logger = Logger.getLogger(context);
		loggers.put(context, logger);
	}
	return logger;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:14,代码来源:JBossLogger.java


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