本文整理匯總了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();
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
}
示例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);
}
}
示例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");
}
示例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);
}
}
示例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);
}
}
}
示例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." );
}
示例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
);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
}