Java 类org.slf4j.impl.StaticLoggerBinder 实例源码

项目:dbsync    文件:DbSyncApplication.java   
@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();
}
项目:graviteeio-access-management    文件:Container.java   
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);
    }
}
项目:konker-platform    文件:KonkerLoggerFactory.java   
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);
    }

}
项目:haven-platform    文件:LogbackConfigurationListener.java   
@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);
        }
    }
}
项目:gravitee-management-rest-api    文件:Container.java   
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);
    }
}
项目:gravitee-gateway    文件:Container.java   
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);
    }
}
项目:bartleby    文件:LoggerFactory.java   
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);
    }
}
项目:bartleby    文件:LoggerFactory.java   
/**
 * 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");
}
项目:event-store-maven-plugin    文件:EventStoreCertificateMojo.java   
@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);
    }

}
项目:jcabi-latex-maven-plugin    文件:CompileMojo.java   
@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);
        }
    }
}
项目:Rob-Maven-and-Gradle-Plugins    文件:RobLogsMojo.java   
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." );
}
项目:qulice    文件:AbstractQuliceMojo.java   
@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
    );
}
项目:requs    文件:ReportMojo.java   
@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);
}
项目:jcabi-maven-plugin    文件:VersionalizeMojo.java   
@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);
    }
}
项目:jcabi-ssl-maven-plugin    文件:KeygenMojo.java   
/**
 * {@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);
}
项目:konker-platform    文件:KonkerLoggerFactory.java   
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);
    }

}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:LogbackLoggingSystem.java   
private LoggerContext getLoggerContext() {
    ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
    Assert.isInstanceOf(LoggerContext.class, factory,
            String.format(
                    "LoggerFactory is not a Logback LoggerContext but Logback is on "
                            + "the classpath. Either remove Logback or the competing "
                            + "implementation (%s loaded from %s). If you are using "
                            + "WebLogic you will need to add 'org.slf4j' to "
                            + "prefer-application-packages in WEB-INF/weblogic.xml",
                    factory.getClass(), getLocation(factory)));
    return (LoggerContext) factory;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:LogbackLoggingSystemTests.java   
@Test
public void testBasicConfigLocation() throws Exception {
    this.loggingSystem.beforeInitialize();
    ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
    LoggerContext context = (LoggerContext) factory;
    Logger root = context.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
    assertThat(root.getAppender("CONSOLE")).isNotNull();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringBootJoranConfiguratorTests.java   
@Before
public void setup() {
    this.environment = new MockEnvironment();
    this.initializationContext = new LoggingInitializationContext(this.environment);
    this.configurator = new SpringBootJoranConfigurator(this.initializationContext);
    StaticLoggerBinder binder = StaticLoggerBinder.getSingleton();
    this.context = (LoggerContext) binder.getLoggerFactory();
    this.logger = this.context.getLogger(getClass());
}
项目:eo    文件:CompileMojo.java   
@Override
public void execute() throws MojoFailureException {
    StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
    if (this.targetDirectory.mkdirs()) {
        Logger.info(this, "Directory created: %s", this.targetDirectory);
    }
    try {
        Files.walk(this.sourceDirectory.toPath())
            .filter(file -> !file.toFile().isDirectory())
            .forEach(this::compile);
    } catch (final IOException ex) {
        throw new MojoFailureException(
            new UncheckedText(
                new FormattedText(
                    "Can't list EO files in %s",
                    this.sourceDirectory
                )
            ).asString(),
            ex
        );
    }
    this.project.addCompileSourceRoot(
        this.targetDirectory.getAbsolutePath()
    );
    Logger.info(
        this, "Directory added to sources: %s",
        this.targetDirectory
    );
}
项目:easycode    文件:LocateLogger.java   
/**
 * 自定义加载日志文件,初始化日志框架
 * @param logbackUrl    日志配置文件路径
 * @throws FileNotFoundException
 * @throws JoranException
 */
protected void locate(String logbackUrl) throws FileNotFoundException, JoranException {
    if(Strings.isBlank(logbackUrl)) return;
    logbackUrl = (logbackUrl = logbackUrl.trim()).startsWith(CLASS_PREFIX) 
            ? logbackUrl : CLASS_PREFIX + logbackUrl;
    URL url = ResourceUtils.getURL(logbackUrl);
       LoggerContext loggerContext = (LoggerContext)StaticLoggerBinder.getSingleton().getLoggerFactory();
       loggerContext.reset();
       new ContextInitializer(loggerContext).configureByResource(url);
}
项目:spring-boot-concourse    文件:LogbackLoggingSystem.java   
private LoggerContext getLoggerContext() {
    ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
    Assert.isInstanceOf(LoggerContext.class, factory,
            String.format(
                    "LoggerFactory is not a Logback LoggerContext but Logback is on "
                            + "the classpath. Either remove Logback or the competing "
                            + "implementation (%s loaded from %s). If you are using "
                            + "WebLogic you will need to add 'org.slf4j' to "
                            + "prefer-application-packages in WEB-INF/weblogic.xml",
                    factory.getClass(), getLocation(factory)));
    return (LoggerContext) factory;
}
项目:spring-boot-concourse    文件:LogbackLoggingSystemTests.java   
@Test
public void testBasicConfigLocation() throws Exception {
    this.loggingSystem.beforeInitialize();
    ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
    LoggerContext context = (LoggerContext) factory;
    Logger root = context.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
    assertThat(root.getAppender("CONSOLE")).isNotNull();
}
项目:spring-boot-concourse    文件:SpringBootJoranConfiguratorTests.java   
@Before
public void setup() {
    this.environment = new MockEnvironment();
    this.initializationContext = new LoggingInitializationContext(this.environment);
    this.configurator = new SpringBootJoranConfigurator(this.initializationContext);
    StaticLoggerBinder binder = StaticLoggerBinder.getSingleton();
    this.context = (LoggerContext) binder.getLoggerFactory();
    this.logger = this.context.getLogger(getClass());
}
项目:nexus-public    文件:TaskLogHome.java   
/**
 * Get the home (absolute path) of the task logs on disk
 *
 * @return the task log home, null if it couldn't be found (usually due to missing appender in logback.xml)
 */
@Nullable
public static String getTaskLogHome() {
  LoggerContext loggerContext = (LoggerContext) StaticLoggerBinder.getSingleton().getLoggerFactory();

  Appender appender = loggerContext.getLogger(ROOT_LOGGER_NAME).getAppender("tasklogfile");
  if (!(appender instanceof SiftingAppender)) {
    // We are forgiving if the task log appender does not exist. It could be that a user had a customized logback.xml
    // as of 3.4.1 when task logging was introduced. We don't want to block application start in this scenario.
    log.error("Could not find a Logback SiftingAppender named 'tasklogfile' in the logback configuration. " +
       "Please check that the 'tasklogfile' appender exists in logback.xml");
    return null;
  }
  SiftingAppender siftingAppender = (SiftingAppender) appender;

  // this will create a new appender which ultimately creates a temp.log within the tasks log folder
  FileAppender tempFileAppender = (FileAppender) siftingAppender.getAppenderTracker().getOrCreate("temp", 0L);

  // Note that at full execution speed the temp.log may not actually exist yet, but we don't actually need it to
  File file = new File(tempFileAppender.getFile());

  String taskLogsFolder = file.getParent();

  // no need to keep the temp.log file around
  tempFileAppender.stop(); // stop the appender to release file lock (windows)
  FileUtils.deleteQuietly(file);

  return taskLogsFolder;
}
项目:nexus-public    文件:LogbackLogManager.java   
/**
 * Returns the current logger-context.
 */
@VisibleForTesting
static LoggerContext loggerContext() {
  ILoggerFactory factory = LoggerFactory.getILoggerFactory();
  if (factory instanceof LoggerContext) {
    return (LoggerContext) factory;
  }
  // Pax-Logging registers a custom implementation of ILoggerFactory which hides logback; as a workaround
  // we set org.ops4j.pax.logging.StaticLogbackContext=true in system.properties and access it statically
  return (LoggerContext) StaticLoggerBinder.getSingleton().getLoggerFactory();
}
项目:contestparser    文件:LogbackLoggingSystem.java   
private LoggerContext getLoggerContext() {
    ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
    Assert.isInstanceOf(LoggerContext.class, factory,
            String.format(
                    "LoggerFactory is not a Logback LoggerContext but Logback is on "
                            + "the classpath. Either remove Logback or the competing "
                            + "implementation (%s loaded from %s). If you are using "
                            + "Weblogic you will need to add 'org.slf4j' to "
                            + "prefer-application-packages in WEB-INF/weblogic.xml",
                    factory.getClass(), getLocation(factory)));
    return (LoggerContext) factory;
}
项目:contestparser    文件:LogbackLoggingSystemTests.java   
@Test
public void testBasicConfigLocation() throws Exception {
    this.loggingSystem.beforeInitialize();
    ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
    LoggerContext context = (LoggerContext) factory;
    Logger root = context.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
    assertNotNull(root.getAppender("CONSOLE"));
}
项目:contestparser    文件:SpringBootJoranConfiguratorTests.java   
@Before
public void setup() {
    this.environment = new MockEnvironment();
    this.initializationContext = new LoggingInitializationContext(this.environment);
    this.configurator = new SpringBootJoranConfigurator(this.initializationContext);
    StaticLoggerBinder binder = StaticLoggerBinder.getSingleton();
    this.context = (LoggerContext) binder.getLoggerFactory();
    this.logger = this.context.getLogger(getClass());
}
项目:gradle-defaults    文件:Projects.java   
/**
 * Change the LogLevel used by the static instance of LoggerFactory.
 * <p>
 * Note that this affects a static factory, so changes will be reflected by anything that uses the same classloader.
 */
public static void setLogLevel(LogLevel logLevel) {
    final ILoggerFactory loggerFactory = StaticLoggerBinder.getSingleton().getLoggerFactory();

    tryRun(() -> {
        final Class<? extends ILoggerFactory> loggerFactoryClass = loggerFactory.getClass();
        loggerFactoryClass.getMethod("setLevel", LogLevel.class).invoke(loggerFactory, logLevel);
        final Object eventListener = loggerFactoryClass.getMethod("getOutputEventListener").invoke(loggerFactory);
        if (eventListener == null) throw new IllegalStateException("eventListener == null for " + loggerFactory);
        eventListener.getClass().getMethod("configure", LogLevel.class).invoke(eventListener, logLevel);
    });
}
项目:event-store-maven-plugin    文件:AbstractEventStoreMojo.java   
@Override
public final void execute() throws MojoExecutionException {
    StaticLoggerBinder.getSingleton().setMavenLog(getLog());
    init();
    LOG.info("version-url={}", versionUrl);
    LOG.info("download-url={}", downloadUrl);
    LOG.info("base-url={}", baseUrl);
    LOG.info("archive-name={}", archiveName);
    LOG.info("archive-version={}", archiveVersion);
    LOG.info("archive-extension={}", archiveExtension);
    LOG.info("target-dir={}", targetDir);
    LOG.info("event-store-dir={}", eventStoreDir);
    executeGoal();
}
项目:LogManager    文件:TestLogback.java   
@BeforeClass
public static void init() {
    System.setProperty("java.util.logging.manager", JulLogManager.class.getName());

    ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
    if ( factory instanceof LoggerContext ) {
        loggerContext = (LoggerContext)factory;
    } else {
        loggerContext = new LoggerContext();
        loggerContext.setName(CoreConstants.DEFAULT_CONTEXT_NAME);
    }
}
项目:qulice    文件:MavenEnvironmentMocker.java   
/**
 * Mock it.
 * @return The environment just mocked
 * @throws Exception If something wrong happens inside
 */
public MavenEnvironment mock() throws Exception {
    StaticLoggerBinder.getSingleton().setMavenLog(Mockito.mock(Log.class));
    this.prj.inBasedir(this.ienv.basedir());
    final MavenProject project = this.prj.mock();
    final Environment parent = this.ienv;
    final MavenEnvironment env = Mockito.mock(MavenEnvironment.class);
    Mockito.doReturn(project).when(env).project();
    final Context context = Mockito.mock(Context.class);
    Mockito.doReturn(context).when(env).context();
    Mockito.doReturn(this.container).when(context).get(Mockito.anyString());
    Mockito.doReturn(this.ass).when(env).asserts();
    return new MavenEnvironment.Wrap(parent, env);
}
项目:requs    文件:CompileMojo.java   
@Override
public void execute() throws MojoFailureException {
    StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
    if (!this.input.exists()) {
        Logger.info(this, "input directory %s is absent", this.input);
        return;
    }
    try {
        new Compiler(this.input, this.output, this.options).compile();
        final XML srs = new XMLDocument(new File(this.output, "requs.xml"));
        final Collection<XML> errors = srs.nodes("//errors/error");
        final int prefix = this.input.getAbsolutePath().length() + 1;
        if (!errors.isEmpty()) {
            for (final XML error : errors) {
                Logger.error(
                    this, "%s[%s:%s] %s",
                    srs.xpath(
                        String.format(
                            "/spec/files/file[@id='%d']/text()",
                            Integer.parseInt(error.xpath("@file").get(0))
                        )
                    ).get(0).substring(prefix),
                    error.xpath("@line").get(0),
                    error.xpath("@pos").get(0),
                    error.xpath("text()").get(0)
                );
            }
            throw new MojoFailureException(
                String.format(
                    "%d requs error(s), see log above",
                    errors.size()
                )
            );
        }
    } catch (final IOException ex) {
        throw new IllegalArgumentException("IO failure", ex);
    }
}
项目:deadcode4j    文件:AbstractSlf4jMojo.java   
@Override
public final void execute() throws MojoExecutionException, MojoFailureException {
    StaticLoggerBinder staticLoggerBinder = StaticLoggerBinder.getSingleton();
    staticLoggerBinder.setLog(getLog());
    try {
        doExecute();
    } finally {
        staticLoggerBinder.revokeLog();
    }
}
项目:jcabi-mysql-maven-plugin    文件:AbstractMysqlMojo.java   
@Override
public void execute() throws MojoFailureException {
    StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
    if (this.skip) {
        Logger.info(this, "execution skipped because of 'skip' option");
        return;
    }
    this.run(AbstractMysqlMojo.instances());
    if (this.project == null) {
        Logger.warn(
            this,
            "MavenProject not initialized, unable to set property %s",
            AbstractMysqlMojo.PROPERTY_REUSED
        );
    } else {
        Logger.info(
            this,
            "set Maven property %s = %s ",
            AbstractMysqlMojo.PROPERTY_REUSED,
            AbstractMysqlMojo.instances().reusedExistingDatabase()
        );
        this.project.getProperties().setProperty(
            AbstractMysqlMojo.PROPERTY_REUSED,
            Boolean.toString(
                AbstractMysqlMojo.instances().reusedExistingDatabase()
            )
        );
    }
}
项目:hivemq-maven-plugin    文件:HiveMQMojo.java   
/**
 * {@inheritDoc}
 *
 * @throws MojoExecutionException
 * @throws MojoFailureException
 */
public void execute() throws MojoExecutionException, MojoFailureException {

    //Bridging the SLF4J logger to the Maven logger
    StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());

    checkPreconditions();

    final List<String> commands = assembleCommand();

    final Process hivemqProcess = startHiveMQ(commands);

    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
        @Override
        public void run() {
            log.info("Stopping HiveMQ");

            hivemqProcess.destroy();
        }
    }


    ));

    try {
        if (verbose) {
            showProcessOutputs(hivemqProcess);
        }
        hivemqProcess.waitFor();
    } catch (InterruptedException e) {
        throw new MojoFailureException("A interruptedException was thrown");
    }
}
项目:jcabi-heroku-maven-plugin    文件:DeployMojo.java   
@Override
@SuppressWarnings("PMD.PrematureDeclaration")
public void execute() throws MojoFailureException {
    StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
    if (this.skip) {
        Logger.info(this, "execution skipped because of 'skip' option");
        return;
    }
    final long start = System.currentTimeMillis();
    final Heroku heroku = new Heroku(this.git(), this.name);
    final Repo repo = heroku.clone(
        new File(new File(this.project.getBuild().getDirectory()), "heroku")
    );
    try {
        repo.add(
            "settings.xml",
            new VelocityPage(
                "com/jcabi/heroku/maven/plugin/settings.xml.vm"
            ).set("settings", this.settings).toString()
        );
        repo.add(
            "pom.xml",
            new VelocityPage(
                "com/jcabi/heroku/maven/plugin/pom.xml.vm"
            ).set("project", this.project)
                .set("deps", this.deps())
                .set("timestamp", System.currentTimeMillis())
                .toString()
        );
        repo.add("Procfile", this.procfile.trim());
    } catch (final java.io.IOException ex) {
        throw new MojoFailureException("failed to save files", ex);
    }
    repo.commit();
    Logger.info(this, "Done in %[ms]s", System.currentTimeMillis() - start);
}
项目:jcabi-maven-plugin    文件:AjcMojo.java   
@Override
@Loggable(value = Loggable.DEBUG, limit = 1, unit = TimeUnit.MINUTES)
public void execute() throws MojoFailureException {
    StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
    final ArtifactHandler artifactHandler = this.project.getArtifact()
        .getArtifactHandler();
    if (!"java".equalsIgnoreCase(artifactHandler.getLanguage())) {
        Logger.warn(
            this,
            // @checkstyle LineLength (1 line)
            "Not executing AJC as the project is not a Java classpath-capable package"
        );
        return;
    }
    if (this.classesDirectory.mkdirs()) {
        Logger.info(this, "Created classes dir %s", this.classesDirectory);
    }
    if (!this.disableCopy
        && !this.unwovenClassesDir.equals(this.classesDirectory)) {
        this.copyUnwovenClasses();
    }
    if (this.hasClasses() || this.hasSourceroots()) {
        this.executeAJC();
    } else {
        Logger.warn(
            this,
            // @checkstyle LineLength (1 line)
            "Not executing AJC as there is no .class file or source roots file."
        );
    }
}
项目:jcabi-dynamodb-maven-plugin    文件:AbstractDynamoMojo.java   
@Override
public void execute() throws MojoFailureException {
    StaticLoggerBinder.getSingleton().setMavenLog(this.getLog());
    if (this.skip) {
        Logger.info(this, "execution skipped because of 'skip' option");
        return;
    }
    this.environment();
    this.run(AbstractDynamoMojo.INSTANCES);
}