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


Java Logger.getInstance方法代码示例

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


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

示例1: logInTomEE

import org.apache.openejb.util.Logger; //导入方法依赖的package包/类
private Principal logInTomEE(final Principal pcp) {
    if (pcp == null) {
        return null;
    }
    if (securityService == null) { // tomee-embedded get it later than startInternals so we need it this way
        securityService = (TomcatSecurityService) SystemInstance.get().getComponent(SecurityService.class);
    }

    // normally we don't care about oldstate because the listener already contains one
    // which is the previous one
    // so no need to clean twice here
    final Request request = OpenEJBSecurityListener.requests.get();
    if (request != null) {
        final Object securityContext = securityService.enterWebApp(this, pcp, OpenEJBSecurityListener.requests.get().getWrapper().getRunAs());
        request.setNote(SECURITY_NOTE, securityContext);
    } else {
        final CUTask.Context context = CUTask.Context.CURRENT.get();
        if (context != null) {
            final Object state = securityService.enterWebApp(this, pcp, null);
            context.pushExitTask(new Runnable() {
                @Override
                public void run() {
                    securityService.exitWebApp(state);
                }
            });
        } else {
            final Logger instance = Logger.getInstance(LogCategory.OPENEJB_SECURITY, TomEERealm.class);
            if (instance.isDebugEnabled()) {
                instance.debug(
                    "No request or concurrency-utilities context so skipping login context propagation, " +
                    "thread=" + Thread.currentThread().getName());
            }
        }
    }
    return pcp;
}
 
开发者ID:apache,项目名称:tomee,代码行数:37,代码来源:TomEERealm.java

示例2: getLooger

import org.apache.openejb.util.Logger; //导入方法依赖的package包/类
protected java.util.logging.Logger getLooger() throws Exception {
    final Logger logger = Logger.getInstance(LogCategory.OPENEJB_RS, RESTService.class);
    final LogStreamAsync stream = LogStreamAsync.class.cast(Reflections.get(logger, "logStream"));
    final JuliLogStream ls = JuliLogStream.class.cast(Reflections.get(stream, "ls"));
    final LoggerCreator julCreator = LoggerCreator.class.cast(Reflections.get(ls, "logger"));
    return julCreator.call();
}
 
开发者ID:apache,项目名称:tomee,代码行数:8,代码来源:LoggingJAXRSCommons.java

示例3: init

import org.apache.openejb.util.Logger; //导入方法依赖的package包/类
@Override
public void init(final Properties props) throws Exception {

    this.logger = Logger.getInstance(LogCategory.OPENEJB_SERVER.createChild("service." + getName()), "org.apache.openejb.server.util.resources");
    this.debug = this.logger.isDebugEnabled();

    super.init(props);
}
 
开发者ID:apache,项目名称:tomee,代码行数:9,代码来源:ServiceLogger.java

示例4: applyTransactionAttributes

import org.apache.openejb.util.Logger; //导入方法依赖的package包/类
public static void applyTransactionAttributes(final BeanContext beanContext, List<MethodTransactionInfo> methodTransactionInfos) throws OpenEJBException {

        if (beanContext.isBeanManagedTransaction()) {
            return;
        }

        methodTransactionInfos = normalize(methodTransactionInfos);

        final Map<MethodInfoUtil.ViewMethod, MethodAttributeInfo> attributes = resolveViewAttributes(methodTransactionInfos, beanContext);

        final Logger log = Logger.getInstance(LogCategory.OPENEJB_STARTUP.createChild("attributes"), MethodTransactionBuilder.class);
        final boolean debug = log.isDebugEnabled();

        for (final Map.Entry<MethodInfoUtil.ViewMethod, MethodAttributeInfo> entry : attributes.entrySet()) {
            final MethodInfoUtil.ViewMethod viewMethod = entry.getKey();
            final Method method = viewMethod.getMethod();
            final String view = viewMethod.getView();

            final MethodTransactionInfo transactionInfo = (MethodTransactionInfo) entry.getValue();

            if (debug) {
                log.debug("Transaction Attribute: " + method + " -- " + MethodInfoUtil.toString(transactionInfo));
            }

            beanContext.setMethodTransactionAttribute(method, TransactionType.get(transactionInfo.transAttribute), view);
        }
    }
 
开发者ID:apache,项目名称:tomee,代码行数:28,代码来源:MethodTransactionBuilder.java

示例5: checkOutput

import org.apache.openejb.util.Logger; //导入方法依赖的package包/类
@Test
public void checkOutput() throws Exception {
    final Logger logger = Logger.getInstance(LogCategory.OPENEJB_SQL, LoggingPreparedSqlStatement.class);
    final JuliLogStream stream = JuliLogStream.class.cast(Reflections.get(logger, "logStream"));
    final LoggerCreator julCreator = LoggerCreator.class.cast(Reflections.get(stream, "logger"));
    final java.util.logging.Logger actualLogger = julCreator.call();
    final Collection<String> msgs = new LinkedList<>();
    final Handler handler = new Handler() {
        @Override
        public void publish(final LogRecord record) {
            msgs.add(record.getMessage());
        }

        @Override
        public void flush() {
            // no-op
        }

        @Override
        public void close() throws SecurityException {
            // no-op
        }
    };
    actualLogger.addHandler(handler);

    final Connection c = ds.getConnection();
    final PreparedStatement preparedStatement = c.prepareStatement("select 1 from INFORMATION_SCHEMA.SYSTEM_USERS");
    preparedStatement.execute();
    preparedStatement.close();
    c.close();

    actualLogger.removeHandler(handler);
    assertEquals(1, msgs.size());

    final String msg = msgs.iterator().next();
    assertTrue(msg.contains("select 1 from INFORMATION_SCHEMA.SYSTEM_USERS"));
    assertTrue(msg.contains("stack: -> org.apache.openejb.resource.jdbc.logging.LoggingSqlTest.checkOutput:83"));
}
 
开发者ID:apache,项目名称:tomee,代码行数:39,代码来源:LoggingSqlTest.java

示例6: LiveReloadEndpoint

import org.apache.openejb.util.Logger; //导入方法依赖的package包/类
public LiveReloadEndpoint() {
    this.watcher = Instances.get().getWatcher();
    this.mapper = Instances.get().getMapper();
    this.logger = Logger.getInstance(Instances.get().getLogCategory(), LiveReloadEndpoint.class);
}
 
开发者ID:apache,项目名称:tomee,代码行数:6,代码来源:LiveReloadEndpoint.java

示例7: FileWatcher

import org.apache.openejb.util.Logger; //导入方法依赖的package包/类
public FileWatcher(final LogCategory logger, final Mapper mapper) {
    this.logger = Logger.getInstance(logger, FileWatcher.class);
    this.mapper = mapper;
}
 
开发者ID:apache,项目名称:tomee,代码行数:5,代码来源:FileWatcher.java

示例8: HsqlPrintWriter

import org.apache.openejb.util.Logger; //导入方法依赖的package包/类
public HsqlPrintWriter(boolean errorWriter) {
    super(System.err);
    logger = Logger.getInstance(LogCategory.OPENEJB_HSQL, HsqlPrintWriter.class);
    this.errorWriter = errorWriter;
}
 
开发者ID:apache,项目名称:tomee,代码行数:6,代码来源:HsqlPrintWriter.java

示例9: build

import org.apache.openejb.util.Logger; //导入方法依赖的package包/类
public Tracker build() {
    logger = Logger.getInstance(LogCategory.OPENEJB_SERVER.createChild("discovery"), Tracker.class);
    return new Tracker(group, heartRate, maxMissedHeartbeats, reconnectDelay, maxReconnectDelay, maxReconnectAttempts, exponentialBackoff, logger, debug);
}
 
开发者ID:apache,项目名称:tomee,代码行数:5,代码来源:Tracker.java

示例10: logger

import org.apache.openejb.util.Logger; //导入方法依赖的package包/类
private static Logger logger() { // don't trigger init too eagerly to be sure to be configured
    if (logger == null) {
        logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP, OpenEjbContainer.class);
    }
    return logger;
}
 
开发者ID:apache,项目名称:tomee,代码行数:7,代码来源:OpenEjbContainer.java

示例11: logger

import org.apache.openejb.util.Logger; //导入方法依赖的package包/类
private static Logger logger() { // do it lazily to avoid to trigger logger creation before properties are read + generally useless
    return Logger.getInstance(LogCategory.OPENEJB_STARTUP, "org.apache.openejb.util.resources");
}
 
开发者ID:apache,项目名称:tomee,代码行数:4,代码来源:OpenEJB.java

示例12: OpenEJBCommonsLog

import org.apache.openejb.util.Logger; //导入方法依赖的package包/类
public OpenEJBCommonsLog(final String category) {
    this.category = category;
    logger = Logger.getInstance(LogCategory.OPENEJB, category);
}
 
开发者ID:apache,项目名称:tomee,代码行数:5,代码来源:OpenEJBCommonsLog.java

示例13: readObject

import org.apache.openejb.util.Logger; //导入方法依赖的package包/类
private void readObject(final ObjectInputStream in) throws IOException {
    logger = Logger.getInstance(LogCategory.OPENEJB, in.readUTF());
}
 
开发者ID:apache,项目名称:tomee,代码行数:4,代码来源:OpenEJBCommonsLog.java

示例14: Assembler

import org.apache.openejb.util.Logger; //导入方法依赖的package包/类
public Assembler(final JndiFactory jndiFactory) {
    logger = Logger.getInstance(LogCategory.OPENEJB_STARTUP, Assembler.class);
    skipLoaderIfPossible = "true".equalsIgnoreCase(SystemInstance.get().getProperty("openejb.classloader.skip-app-loader-if-possible", "true"));
    resourceDestroyTimeout = SystemInstance.get().getProperty("openejb.resources.destroy.timeout");
    threadStackOnTimeout = "true".equals(SystemInstance.get().getProperty("openejb.resources.destroy.stack-on-timeout", "false"));
    persistenceClassLoaderHandler = new PersistenceClassLoaderHandlerImpl();

    installNaming();

    final SystemInstance system = SystemInstance.get();

    system.setComponent(org.apache.openejb.spi.Assembler.class, this);
    system.setComponent(Assembler.class, this);

    containerSystem = new CoreContainerSystem(jndiFactory);
    system.setComponent(ContainerSystem.class, containerSystem);

    jndiBuilder = new JndiBuilder(containerSystem.getJNDIContext());

    setConfiguration(new OpenEjbConfiguration());

    final ApplicationServer appServer = system.getComponent(ApplicationServer.class);
    if (appServer == null) {
        system.setComponent(ApplicationServer.class, new ServerFederation());
    }

    system.setComponent(EjbResolver.class, new EjbResolver(null, EjbResolver.Scope.GLOBAL));

    installExtensions();

    system.fireEvent(new AssemblerCreated());

    initBValFiltering();
}
 
开发者ID:apache,项目名称:tomee,代码行数:35,代码来源:Assembler.java


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