Java Code Examples for sun.util.logging.PlatformLogger#Bridge

The following examples show how to use sun.util.logging.PlatformLogger#Bridge . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LazyLoggers.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * Makes this accessor release a temporary logger.
 * This method is called
 * by BootstrapLogger when JUL is the default backend and LogManager
 * is initialized, in order to replace temporary SimpleConsoleLoggers by
 * real JUL loggers. See BootstrapLogger for more details.
 * If {@code replace} is {@code true}, then this method will force
 * the accessor to eagerly recreate its wrapped logger.
 * Note: passing {@code replace=false} is no guarantee that the
 * method will not actually replace the released logger.
 * @param temporary The temporary logger too be released.
 * @param replace   Whether the released logger should be eagerly
 *                  replaced.
 */
void release(SimpleConsoleLogger temporary, boolean replace) {
    PlatformLogger.ConfigurableBridge.LoggerConfiguration conf =
        PlatformLogger.ConfigurableBridge.getLoggerConfiguration(temporary);
    PlatformLogger.Level level = conf != null
            ? conf.getPlatformLevel()
            : null;
    synchronized (this) {
        if (this.w == temporary) {
            this.w = null; this.p = null;
        }
    }
    PlatformLogger.Bridge platform =  replace || level != null
            ? this.platform() : null;

    if (level != null) {
        conf = (platform != null && platform != temporary)
                ? PlatformLogger.ConfigurableBridge.getLoggerConfiguration(platform)
                : null;
        if (conf != null) conf.setPlatformLevel(level);
    }
}
 
Example 2
Source File: BootstrapLogger.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void log(PlatformLogger.Level level, Throwable thrown,
        Supplier<String> msgSupplier) {
    if (checkBootstrapping()) {
        push(LogEvent.vaueOf(this, level, msgSupplier, thrown));
    } else {
        final PlatformLogger.Bridge spi = holder.platform();
        spi.log(level, thrown, msgSupplier);
    }
}
 
Example 3
Source File: LazyLoggers.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
PlatformLogger.Bridge getConcretePlatformLogger(BootstrapLogger bootstrap) {
    assert VM.isBooted();
    synchronized(this) {
        // another thread may have already invoked flush()
        if (this.w == bootstrap) {
            this.w = null; this.p = null;
        }
    }
    return this.platform();
}
 
Example 4
Source File: BootstrapLogger.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public void log(PlatformLogger.Level level, Throwable thrown,
        Supplier<String> msgSupplier) {
    if (checkBootstrapping()) {
        push(LogEvent.vaueOf(this, level, msgSupplier, thrown));
    } else {
        final PlatformLogger.Bridge spi = holder.platform();
        spi.log(level, thrown, msgSupplier);
    }
}
 
Example 5
Source File: BootstrapLogger.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public void logp(PlatformLogger.Level level, String sourceClass,
        String sourceMethod, String msg, Object... params) {
    if (checkBootstrapping()) {
        push(LogEvent.valueOf(this, level, sourceClass, sourceMethod, null, msg, params));
    } else {
        final PlatformLogger.Bridge spi = holder.platform();
        spi.logp(level, sourceClass, sourceMethod, msg, params);
    }
}
 
Example 6
Source File: BootstrapLogger.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public void log(PlatformLogger.Level level, String msg) {
    if (checkBootstrapping()) {
        push(LogEvent.valueOf(this, level, msg));
    } else {
        final PlatformLogger.Bridge spi = holder.platform();
        spi.log(level, msg);
    }
}
 
Example 7
Source File: BootstrapLogger.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isEnabled() {
    if (checkBootstrapping()) {
        return true;
    } else {
        final PlatformLogger.Bridge spi = holder.platform();
        return spi.isEnabled();
    }
}
 
Example 8
Source File: BootstrapLogger.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isLoggable(PlatformLogger.Level level) {
    if (checkBootstrapping()) {
        return level.intValue() >= PlatformLogger.Level.INFO.intValue();
    } else {
        final PlatformLogger.Bridge spi = holder.platform();
        return spi.isLoggable(level);
    }
}
 
Example 9
Source File: BootstrapLogger.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void log(PlatformLogger.Level level, String msg, Throwable thrown) {
    if (checkBootstrapping()) {
        push(LogEvent.valueOf(this, level, msg, thrown));
    } else {
        final PlatformLogger.Bridge spi = holder.platform();
        spi.log(level, msg, thrown);
    }
}
 
Example 10
Source File: AbstractLoggerWrapper.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public void logrb(PlatformLogger.Level level, ResourceBundle bundle,
                  String msg, Object... params) {
    final PlatformLogger.Bridge platformProxy = platformProxy();
    if (platformProxy == null)  {
        wrapped().log(level.systemLevel(), bundle, msg, params);
    } else {
        platformProxy.logrb(level, bundle, msg, params);
    }
}
 
Example 11
Source File: BootstrapLogger.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void logrb(PlatformLogger.Level level, String sourceClass,
        String sourceMethod, ResourceBundle bundle, String msg, Throwable thrown) {
    if (checkBootstrapping()) {
        push(LogEvent.valueOf(this, level, sourceClass, sourceMethod, bundle, msg, thrown));
    } else {
        final PlatformLogger.Bridge spi = holder.platform();
        spi.logrb(level, sourceClass, sourceMethod, bundle, msg, thrown);
    }
}
 
Example 12
Source File: AbstractLoggerWrapper.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public void log(PlatformLogger.Level level, Throwable thrown,
                Supplier<String> msgSupplier) {
    final PlatformLogger.Bridge platformProxy = platformProxy();
    if (platformProxy == null)  {
        wrapped().log(level.systemLevel(), msgSupplier, thrown);
    } else {
        platformProxy.log(level, thrown, msgSupplier);
    }
}
 
Example 13
Source File: BootstrapLogger.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void log(PlatformLogger.Level level, String msg, Object... params) {
    if (checkBootstrapping()) {
        push(LogEvent.valueOf(this, level, msg, params));
    } else {
        final PlatformLogger.Bridge spi = holder.platform();
        spi.log(level, msg, params);
    }
}
 
Example 14
Source File: AbstractLoggerWrapper.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public void log(PlatformLogger.Level level, String msg, Object... params) {
    final PlatformLogger.Bridge platformProxy = platformProxy();
    if (platformProxy == null)  {
        wrapped().log(level.systemLevel(), msg, params);
    } else {
        platformProxy.log(level, msg, params);
    }
}
 
Example 15
Source File: AbstractLoggerWrapper.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public void log(PlatformLogger.Level level, String msg, Throwable thrown) {
    final PlatformLogger.Bridge platformProxy = platformProxy();
    if (platformProxy == null)  {
        wrapped().log(level.systemLevel(), msg, thrown);
    } else {
        platformProxy.log(level, msg, thrown);
    }
}
 
Example 16
Source File: AbstractLoggerWrapper.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public void log(PlatformLogger.Level level, String msg) {
    final PlatformLogger.Bridge platformProxy = platformProxy();
    if (platformProxy == null)  {
        wrapped().log(level.systemLevel(), msg);
    } else {
        platformProxy.log(level, msg);
    }
}
 
Example 17
Source File: BootstrapLogger.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public LoggerConfiguration getLoggerConfiguration() {
    if (checkBootstrapping()) {
        // This practically means that PlatformLogger.setLevel()
        // calls will be ignored if the VM is still bootstrapping. We could
        // attempt to fix that but is it worth it?
        return PlatformLogger.ConfigurableBridge.super.getLoggerConfiguration();
    } else {
        final PlatformLogger.Bridge spi = holder.platform();
        return PlatformLogger.ConfigurableBridge.getLoggerConfiguration(spi);
    }
}
 
Example 18
Source File: BootstrapLogger.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void logp(PlatformLogger.Level level, String sourceClass,
        String sourceMethod, String msg, Object... params) {
    if (checkBootstrapping()) {
        push(LogEvent.valueOf(this, level, sourceClass, sourceMethod, null, msg, params));
    } else {
        final PlatformLogger.Bridge spi = holder.platform();
        spi.logp(level, sourceClass, sourceMethod, msg, params);
    }
}
 
Example 19
Source File: LoggerWrapper.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
LoggerWrapper(L wrapped, Void unused) {
    this.wrapped = wrapped;
    this.platformProxy = (wrapped instanceof PlatformLogger.Bridge) ?
        (PlatformLogger.Bridge) wrapped : null;
}
 
Example 20
Source File: LazyLoggers.java    From Bytecoder with Apache License 2.0 2 votes vote down vote up
/**
 * A PlatformLogger.Bridge view of the wrapped logger object.
 * @return A PlatformLogger.Bridge view of the wrapped logger object.
 */
public PlatformLogger.Bridge platform();