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


Java BasicLogger类代码示例

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


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

示例1: handleCustomLog

import org.jboss.logging.BasicLogger; //导入依赖的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

示例2: handleResponse

import org.jboss.logging.BasicLogger; //导入依赖的package包/类
public void handleResponse(DataInput input, File localPath, BasicLogger log, ActiveOperation.ResultHandler<File> resultHandler, ManagementRequestContext<Void> context)
        throws IOException, CannotCreateLocalDirectoryException, DidNotReadEntireFileException{
    expectHeader(input, protocol.paramNumFiles());
    int numFiles = input.readInt();
    log.debugf("Received %d files for %s", numFiles, localPath);
    switch (numFiles) {
        case -1: { // Not found on DC
            break;
        }
        case 0: { // Found on DC, but was an empty dir
            if (!localPath.mkdirs()) {
                throw new CannotCreateLocalDirectoryException(localPath);
            }
            break;
        }
        default: { // Found on DC
            for (int i = 0; i < numFiles; i++) {
                expectHeader(input, protocol.fileStart());
                expectHeader(input, protocol.paramFilePath());
                final String path = input.readUTF();
                expectHeader(input, protocol.paramFileSize());
                final long length = input.readLong();
                log.debugf("Received file [%s] of length %d", path, length);
                final File file = new File(localPath, path);
                if (!file.getParentFile().exists() && !file.getParentFile().mkdirs()) {
                    throw new CannotCreateLocalDirectoryException(localPath.getParentFile());
                }
                if(length == 0L) {
                    file.mkdir();
                } else {
                    long totalRead = 0;
                    try (OutputStream fileOut = new BufferedOutputStream(new FileOutputStream(file))) {
                        final byte[] buffer = new byte[8192];
                        while (totalRead < length) {
                            int len = Math.min((int) (length - totalRead), buffer.length);
                            input.readFully(buffer, 0, len);
                            fileOut.write(buffer, 0, len);
                            totalRead += len;
                        }
                    }
                    if (totalRead != length) {
                        throw new DidNotReadEntireFileException((length - totalRead));
                    }
                }
                expectHeader(input, protocol.fileEnd());
            }
        }
    }
    resultHandler.done(localPath);
}
 
开发者ID:wildfly,项目名称:wildfly-core,代码行数:51,代码来源:RemoteFileRequestAndHandler.java


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