當前位置: 首頁>>代碼示例>>Java>>正文


Java StaticLoggerBinder類代碼示例

本文整理匯總了Java中org.slf4j.impl.StaticLoggerBinder的典型用法代碼示例。如果您正苦於以下問題:Java StaticLoggerBinder類的具體用法?Java StaticLoggerBinder怎麽用?Java StaticLoggerBinder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


StaticLoggerBinder類屬於org.slf4j.impl包,在下文中一共展示了StaticLoggerBinder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import org.slf4j.impl.StaticLoggerBinder; //導入依賴的package包/類
@Override
public void onCreate() {
    super.onCreate();

    StaticLoggerBinder.init(this);
    log = LoggerFactory.getLogger(DbSyncApplication.class);

    log.info("onCreate");

    db1OpenHelper = new Db1OpenHelper(this);
    db1OpenHelper.getReadableDatabase();

    db2OpenHelper = new Db2OpenHelper(this);
    db2OpenHelper.getReadableDatabase();

    db3OpenHelper = new Db3OpenHelper(this);
    db3OpenHelper.getReadableDatabase();

    db4OpenHelper = new Db4OpenHelper(this);
    db4OpenHelper.getReadableDatabase();

    db5OpenHelper = new Db5OpenHelper(this);
    db5OpenHelper.getReadableDatabase();
}
 
開發者ID:claudiodegio,項目名稱:dbsync,代碼行數:25,代碼來源:DbSyncApplication.java

示例2: initializeLogging

import org.slf4j.impl.StaticLoggerBinder; //導入依賴的package包/類
private void initializeLogging() {
    String graviteeHome = System.getProperty("gravitee.home");
    String logbackConfiguration = graviteeHome + File.separator + "config" + File.separator + "logback.xml";
    File logbackConfigurationfile = new File(logbackConfiguration);

    // If logback configuration available, load it, else, load default logback configuration
    if (logbackConfigurationfile.exists()) {
        System.setProperty("logback.configurationFile", logbackConfigurationfile.getAbsolutePath());
        StaticLoggerBinder loggerBinder = StaticLoggerBinder.getSingleton();
        LoggerContext loggerContext = (LoggerContext) loggerBinder.getLoggerFactory();
        loggerContext.reset();
        JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext(loggerContext);
        try {
            configurator.doConfigure(logbackConfigurationfile);
        } catch( JoranException e ) {
            e.printStackTrace();
        }

        // Internal status data is printed in case of warnings or errors.
        StatusPrinter.printInCaseOfErrorsOrWarnings(loggerContext);
    }
}
 
開發者ID:gravitee-io,項目名稱:graviteeio-access-management,代碼行數:24,代碼來源:Container.java

示例3: versionSanityCheck

import org.slf4j.impl.StaticLoggerBinder; //導入依賴的package包/類
private static final void versionSanityCheck() {
    try {
        String e = StaticLoggerBinder.REQUESTED_API_VERSION;
        boolean match = false;
        String[] arr$ = API_COMPATIBILITY_LIST;
        int len$ = arr$.length;

        for(int i$ = 0; i$ < len$; ++i$) {
            String aAPI_COMPATIBILITY_LIST = arr$[i$];
            if(e.startsWith(aAPI_COMPATIBILITY_LIST)) {
                match = true;
            }
        }

        if(!match) {
            Util.report("The requested version " + e + " by your slf4j binding is not compatible with " + Arrays.asList(API_COMPATIBILITY_LIST).toString());
            Util.report("See http://www.slf4j.org/codes.html#version_mismatch for further details.");
        }
    } catch (NoSuchFieldError var6) {
        ;
    } catch (Throwable var7) {
        Util.report("Unexpected problem occured during version sanity check", var7);
    }

}
 
開發者ID:KonkerLabs,項目名稱:konker-platform,代碼行數:26,代碼來源:KonkerLoggerFactory.java

示例4: onApplicationEvent

import org.slf4j.impl.StaticLoggerBinder; //導入依賴的package包/類
@Override
public void onApplicationEvent(ApplicationEvent event) {
    final String settings = environment.getProperty("logging.config.src");
    if (StringUtils.hasText(settings)) {
        try {
            final ContextBase context = (ContextBase) StaticLoggerBinder.getSingleton().getLoggerFactory();
            final JoranConfigurator configurator = new JoranConfigurator();
            configurator.setContext(context);
            LOG.info("try to update logback configuration to {}", settings);
            context.reset();
            configurator.doConfigure(new ByteArrayInputStream(settings.getBytes()));
        } catch (JoranException e) {
            LOG.error("can't load settings", e);
        }
    }
}
 
開發者ID:codeabovelab,項目名稱:haven-platform,代碼行數:17,代碼來源:LogbackConfigurationListener.java

示例5: initializeLogging

import org.slf4j.impl.StaticLoggerBinder; //導入依賴的package包/類
private void initializeLogging() {
    String graviteeHome = System.getProperty("gravitee.home");
    String logbackConfiguration = graviteeHome + File.separator + "config" + File.separator + "logback.xml";
    File logbackConfigurationfile = new File(logbackConfiguration);

    // If logback configuration available, load it, else, load default logback configuration
    if (logbackConfigurationfile.exists()) {
        System.setProperty("logback.configurationFile", logbackConfigurationfile.getAbsolutePath());
        StaticLoggerBinder loggerBinder = StaticLoggerBinder.getSingleton();
        LoggerContext loggerContext = (LoggerContext) loggerBinder.getLoggerFactory();
        loggerContext.reset();
        JoranConfigurator configurator = new JoranConfigurator();
        configurator.setContext(loggerContext);
        try {
            configurator.doConfigure(logbackConfigurationfile);
        } catch( JoranException e ) {
            LoggerFactory.getLogger(Container.class).error("An error occurs while initializing logging system", e);
        }

        // Internal status data is printed in case of warnings or errors.
        StatusPrinter.printInCaseOfErrorsOrWarnings(loggerContext);
    }
}
 
開發者ID:gravitee-io,項目名稱:gravitee-gateway,代碼行數:24,代碼來源:Container.java

示例6: versionSanityCheck

import org.slf4j.impl.StaticLoggerBinder; //導入依賴的package包/類
private final static void versionSanityCheck() {
    try {
        String requested = StaticLoggerBinder.REQUESTED_API_VERSION;

        boolean match = false;
        for (int i = 0; i < API_COMPATIBILITY_LIST.length; i++) {
            if (requested.startsWith(API_COMPATIBILITY_LIST[i])) {
                match = true;
            }
        }
        if (!match) {
            Util.report("The requested version " + requested + " by your slf4j binding is not compatible with "
                            + Arrays.asList(API_COMPATIBILITY_LIST).toString());
            Util.report("See " + VERSION_MISMATCH + " for further details.");
        }
    } catch (java.lang.NoSuchFieldError nsfe) {
        // given our large user base and SLF4J's commitment to backward
        // compatibility, we cannot cry here. Only for implementations
        // which willingly declare a REQUESTED_API_VERSION field do we
        // emit compatibility warnings.
    } catch (Throwable e) {
        // we should never reach here
        Util.report("Unexpected problem occured during version sanity check", e);
    }
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:26,代碼來源:LoggerFactory.java

示例7: getILoggerFactory

import org.slf4j.impl.StaticLoggerBinder; //導入依賴的package包/類
/**
 * Return the {@link ILoggerFactory} instance in use.
 * <p/>
 * <p/>
 * ILoggerFactory instance is bound with this class at compile time.
 *
 * @return the ILoggerFactory instance in use
 */
public static ILoggerFactory getILoggerFactory() {
    if (INITIALIZATION_STATE == UNINITIALIZED) {
        INITIALIZATION_STATE = ONGOING_INITIALIZATION;
        performInitialization();
    }
    switch (INITIALIZATION_STATE) {
    case SUCCESSFUL_INITIALIZATION:
        return StaticLoggerBinder.getSingleton().getLoggerFactory();
    case NOP_FALLBACK_INITIALIZATION:
        return NOP_FALLBACK_FACTORY;
    case FAILED_INITIALIZATION:
        throw new IllegalStateException(UNSUCCESSFUL_INIT_MSG);
    case ONGOING_INITIALIZATION:
        // support re-entrant behavior.
        // See also http://bugzilla.slf4j.org/show_bug.cgi?id=106
        return TEMP_FACTORY;
    }
    throw new IllegalStateException("Unreachable code");
}
 
開發者ID:cscfa,項目名稱:bartleby,代碼行數:28,代碼來源:LoggerFactory.java

示例8: execute

import org.slf4j.impl.StaticLoggerBinder; //導入依賴的package包/類
@Override
public final void execute() throws MojoExecutionException {
    StaticLoggerBinder.getSingleton().setMavenLog(getLog());

    LOG.info("certificateFile={}", certificateFile);

    if (certificateFile == null || certificateFile.trim().length() == 0) {
        LOG.info("Skipped generation: No certificate file given");
        return;
    }

    try {
        Security.addProvider(new BouncyCastleProvider());
        final File file = new File(certificateFile);
        createSelfSignedCertificate("test.com", file);
        LOG.info("Certificate successfully created");
    } catch (final RuntimeException ex) {
        throw new MojoExecutionException(
                "Error generating a self-signed X509 certificate: " + certificateFile, ex);
    }

}
 
開發者ID:fuinorg,項目名稱:event-store-maven-plugin,代碼行數:23,代碼來源:EventStoreCertificateMojo.java

示例9: execute

import org.slf4j.impl.StaticLoggerBinder; //導入依賴的package包/類
@Override
public void execute() throws MojoFailureException {
    StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
    if (this.skip) {
        Logger.info(this, "execution skipped because of 'skip' option");
    } else {
        if (SystemUtils.IS_OS_WINDOWS) {
            throw new MojoFailureException(
                "Sorry, this plugin cannot run on Windows system!"
            );
        }
        if (this.outputDir.mkdirs()) {
            Logger.info(this, "directories created for %s", this.outputDir);
        }
        final Compiler compiler = new Compiler(this.tempDir);
        for (final String src : this.sources) {
            this.compile(compiler, src);
        }
    }
}
 
開發者ID:jcabi,項目名稱:jcabi-latex-maven-plugin,代碼行數:21,代碼來源:CompileMojo.java

示例10: execute

import org.slf4j.impl.StaticLoggerBinder; //導入依賴的package包/類
public void execute() throws MojoExecutionException
{
    StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());

    getLog().info( "Robbing..." );

    try {
        Configuration conf = new Configuration.ConfigurationBuilder(StaticLoggerBinder.getSingleton().getLoggerFactory().getLogger(""), api, repository, owner)
                .branch(branch).prefix(prefix).filePath(filePath).fromDate(startDateStr).toDate(endDateStr)
                .token(token).key(key).secret(secret).username(username).password(decrypt(password)).outputDir(targetDirectory).build();

        Rob.logs(conf);

    } catch (Exception e) {
        getLog().error( "Error: " + e.getMessage(), e);
    }

    getLog().info( "Robbed." );
}
 
開發者ID:Shusshu,項目名稱:Rob-Maven-and-Gradle-Plugins,代碼行數:20,代碼來源:RobLogsMojo.java

示例11: execute

import org.slf4j.impl.StaticLoggerBinder; //導入依賴的package包/類
@Override
public final void execute() throws MojoFailureException {
    StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
    if (this.skip) {
        this.getLog().info("Execution skipped");
        return;
    }
    this.environment.setProperty("license", this.license);
    this.environment.setProject(this.project);
    this.environment.setMojoExecutor(
        new MojoExecutor(this.manager, this.sess)
    );
    this.environment.setExcludes(this.excludes);
    this.environment.setAsser(this.asserts);
    final long start = System.nanoTime();
    this.doExecute();
    Logger.info(
        this,
        "Qulice quality check completed in %[nano]s",
        System.nanoTime() - start
    );
}
 
開發者ID:teamed,項目名稱:qulice,代碼行數:23,代碼來源:AbstractQuliceMojo.java

示例12: generate

import org.slf4j.impl.StaticLoggerBinder; //導入依賴的package包/類
@Override
public void generate(final Sink sink, final SinkFactory factory,
    final Locale locale) {
    if (!this.source.exists()) {
        Logger.info(this, "source directory %s is absent", this.source);
        return;
    }
    StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
    final File home = new File(
        this.getOutputDirectory(),
        this.getOutputName()
    );
    if (home.mkdirs()) {
        Logger.info(this, "site directory %s created", home);
    }
    try {
        new Compiler(this.source, home, this.options).compile();
    } catch (final IOException ex) {
        throw new IllegalStateException(ex);
    }
    this.front(sink);
}
 
開發者ID:yegor256,項目名稱:requs,代碼行數:23,代碼來源:ReportMojo.java

示例13: execute

import org.slf4j.impl.StaticLoggerBinder; //導入依賴的package包/類
@Override
@Loggable(value = Loggable.DEBUG, limit = 1, unit = TimeUnit.MINUTES)
public void execute() throws MojoFailureException {
    StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
    final File src = new File(this.project.getBuild().getSourceDirectory());
    if (!src.exists()) {
        Logger.info(this, "source directory '%s' is absent", src);
        return;
    }
    final File dest =
        new File(this.project.getBuild().getOutputDirectory());
    if (dest.mkdirs()) {
        Logger.info(this, "created directory %s", dest);
    }
    Logger.info(this, "Versionalizing %s directory", dest);
    try {
        this.versionalize(src, dest);
    } catch (final IOException ex) {
        throw new MojoFailureException("failed to versionalize", ex);
    }
}
 
開發者ID:jcabi,項目名稱:jcabi-maven-plugin,代碼行數:22,代碼來源:VersionalizeMojo.java

示例14: execute

import org.slf4j.impl.StaticLoggerBinder; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
public void execute() throws MojoFailureException {
    StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
    if (this.skip) {
        Logger.info(this, "execution skipped because of 'skip' option");
        return;
    }
    try {
        if (this.truststore == null) {
            this.truststore = new Cacerts(this.cacerts);
        }
        if (!this.store.isActive()) {
            this.store.activate(this.keystore);
            this.truststore.imprt();
        }
    } catch (final IOException ex) {
        throw new IllegalStateException(ex);
    }
    this.store.populate(this.project.getProperties());
    this.truststore.populate(this.project.getProperties());
    Logger.info(this, "Keystore is active: %s", this.store);
}
 
開發者ID:jcabi,項目名稱:jcabi-ssl-maven-plugin,代碼行數:26,代碼來源:KeygenMojo.java

示例15: bind

import org.slf4j.impl.StaticLoggerBinder; //導入依賴的package包/類
private static final void bind() {
    String msg;
    try {
        Set e = findPossibleStaticLoggerBinderPathSet();
        reportMultipleBindingAmbiguity(e);
        StaticLoggerBinder.getSingleton();
        INITIALIZATION_STATE = 3;
        reportActualBinding(e);
        fixSubstitutedLoggers();
    } catch (NoClassDefFoundError var2) {
        msg = var2.getMessage();
        if(!messageContainsOrgSlf4jImplStaticLoggerBinder(msg)) {
            failedBinding(var2);
            throw var2;
        }

        INITIALIZATION_STATE = 4;
        Util.report("Failed to load class \"org.slf4j.impl.StaticLoggerBinder\".");
        Util.report("Defaulting to no-operation (NOP) logger implementation");
        Util.report("See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.");
    } catch (NoSuchMethodError var3) {
        msg = var3.getMessage();
        if(msg != null && msg.contains("org.slf4j.impl.StaticLoggerBinder.getSingleton()")) {
            INITIALIZATION_STATE = 2;
            Util.report("slf4j-api 1.6.x (or later) is incompatible with this binding.");
            Util.report("Your binding is version 1.5.5 or earlier.");
            Util.report("Upgrade your binding to version 1.6.x.");
        }

        throw var3;
    } catch (Exception var4) {
        failedBinding(var4);
        throw new IllegalStateException("Unexpected initialization failure", var4);
    }

}
 
開發者ID:KonkerLabs,項目名稱:konker-platform,代碼行數:37,代碼來源:KonkerLoggerFactory.java


注:本文中的org.slf4j.impl.StaticLoggerBinder類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。