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


Java Logger類代碼示例

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


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

示例1: waitForInitialDeviceList

import org.gradle.api.logging.Logger; //導入依賴的package包/類
/**
 * Wait for the Android Debug Bridge to return an initial device list.
 */
protected static void waitForInitialDeviceList(final AndroidDebugBridge androidDebugBridge, Logger logger) {
    if (!androidDebugBridge.hasInitialDeviceList()) {
        logger.info("Waiting for initial device list from the Android Debug Bridge");
        long limitTime = System.currentTimeMillis() + ADB_TIMEOUT_MS;
        while (!androidDebugBridge.hasInitialDeviceList() && (System.currentTimeMillis() < limitTime)) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException("Interrupted waiting for initial device list from Android Debug Bridge");
            }
        }
        if (!androidDebugBridge.hasInitialDeviceList()) {
            logger.error("Did not receive initial device list from the Android Debug Bridge.");
        }
    }
}
 
開發者ID:alibaba,項目名稱:atlas,代碼行數:20,代碼來源:AwoInstaller.java

示例2: notifyApppatching

import org.gradle.api.logging.Logger; //導入依賴的package包/類
/**
 * todo how know which app will be debugged?
 * just support taobao.apk now
 */
private static void notifyApppatching(AndroidBuilder androidBuilder, String patchPkg, Logger logger) {
    CommandExecutor executor = CommandExecutor.Factory.createDefaultCommmandExecutor();
    executor.setLogger(logger);
    executor.setCaptureStdOut(true);
    executor.setCaptureStdErr(true);
    //        List<String> killCmd = Arrays.asList("shell", "am", "force-stop", packageNameForPatch);
    //        List<String> startCmd = Arrays.asList("shell", "am", "start", packageNameForPatch + "/" +
    // launcherActivityForPatch);
    List<String> patchCmd = Arrays.asList("shell", "am", "broadcast", "-a", "com.taobao.atlas.intent.PATCH_APP",
                                          "-e", "pkg", patchPkg);
    try {
        executor.executeCommand(androidBuilder.getSdkInfo().getAdb().getAbsolutePath(), patchCmd, false);
    } catch (Exception e) {
        throw new RuntimeException("error while restarting app,you can also restart by yourself", e);
    }
}
 
開發者ID:alibaba,項目名稱:atlas,代碼行數:21,代碼來源:AwoInstaller.java

示例3: parseClassesToMap

import org.gradle.api.logging.Logger; //導入依賴的package包/類
private static List<ClassMapping> parseClassesToMap(String[] renameClasses, Logger logger) {
    ArrayList<ClassMapping> result = new ArrayList<>();

    if (renameClasses == null) {
        return result;
    }

    for (String classRenaming : renameClasses) {
        int indexOfEquals = classRenaming.indexOf("=");
        if (indexOfEquals > 0 && indexOfEquals < classRenaming.length()) {
            String from = classRenaming.substring(0, indexOfEquals);
            String to = classRenaming.substring(indexOfEquals + 1);
            result.add(new ClassMapping(from, to));

        } else {
            logger.error("Unparseable mapping:" + classRenaming);
        }
    }

    return result;
}
 
開發者ID:bjoernQ,項目名稱:unmock-plugin,代碼行數:22,代碼來源:ProcessRealAndroidJar.java

示例4: apply

import org.gradle.api.logging.Logger; //導入依賴的package包/類
@Override
public void apply(final Project project) {
	Logger logger = project.getLogger();
	logger.info("applying jsweet plugin");

	if (!project.getPlugins().hasPlugin(JavaPlugin.class) && !project.getPlugins().hasPlugin(WarPlugin.class)) {
		logger.error("No java or war plugin detected. Enable java or war plugin.");
		throw new IllegalStateException("No java or war plugin detected. Enable java or war plugin.");
	}

	JSweetPluginExtension extension = project.getExtensions().create("jsweet", JSweetPluginExtension.class);

	JavaPluginConvention javaPluginConvention = project.getConvention().getPlugin(JavaPluginConvention.class);
	SourceSetContainer sourceSets = javaPluginConvention.getSourceSets();
	SourceSet mainSources = sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME);

	JSweetTranspileTask task = project.getTasks().create("jsweet", JSweetTranspileTask.class);
	task.setGroup("generate");
	task.dependsOn(JavaPlugin.COMPILE_JAVA_TASK_NAME);
	task.setConfiguration(extension);
	task.setSources(mainSources.getAllJava());
	task.setClasspath(mainSources.getCompileClasspath());
	
	JSweetCleanTask cleanTask = project.getTasks().create("jsweetClean", JSweetCleanTask.class);
	cleanTask.setConfiguration(extension);
}
 
開發者ID:lgrignon,項目名稱:jsweet-gradle-plugin,代碼行數:27,代碼來源:JSweetPlugin.java

示例5: execute

import org.gradle.api.logging.Logger; //導入依賴的package包/類
static WorkResult execute(ScalaJavaJointCompileSpec spec) {
    LOGGER.info("Compiling with Zinc Scala compiler.");

    xsbti.Logger logger = new SbtLoggerAdapter();

    com.typesafe.zinc.Compiler compiler = createCompiler(spec.getScalaClasspath(), spec.getZincClasspath(), logger);
    List<String> scalacOptions = new ScalaCompilerArgumentsGenerator().generate(spec);
    List<String> javacOptions = new JavaCompilerArgumentsBuilder(spec).includeClasspath(false).build();
    Inputs inputs = Inputs.create(ImmutableList.copyOf(spec.getClasspath()), ImmutableList.copyOf(spec.getSource()), spec.getDestinationDir(),
            scalacOptions, javacOptions, spec.getScalaCompileOptions().getIncrementalOptions().getAnalysisFile(), spec.getAnalysisMap(), "mixed", getIncOptions(), true);
    if (LOGGER.isDebugEnabled()) {
        Inputs.debug(inputs, logger);
    }

    try {
        compiler.compile(inputs, logger);
    } catch (xsbti.CompileFailed e) {
        throw new CompilationFailedException(e);
    }

    return new SimpleWorkResult(true);
}
 
開發者ID:Pushjet,項目名稱:Pushjet-Android,代碼行數:23,代碼來源:ZincScalaCompiler.java

示例6: getEv3Host

import org.gradle.api.logging.Logger; //導入依賴的package包/類
private String getEv3Host() {
    Logger logger = getLogger();
    LejosEv3PluginExtension ev3 = getEv3PluginExtension();
    String host;
    if (ev3.discoverBrickEnabled()) {
        BrickInfo brick;
        try {
            brick =  BrickFinder.discover()[0];
        } catch (IOException e) {
            throw new GradleException("Error on discovering bricks", e);
        }
        logger.info("Found brick " + brick.getName() + " at " + brick.getIPAddress());
        host = brick.getIPAddress();
    } else {
        if (ev3.getHost() == null) {
            throw new GradleException("Please set property ev3.host");
        }
        host = ev3.getHost();
    }
    return host;
}
 
開發者ID:mindstorms-cop,項目名稱:lejos-ev3-gradle-plugin,代碼行數:22,代碼來源:Ev3DeployTask.java

示例7: GitHubApi

import org.gradle.api.logging.Logger; //導入依賴的package包/類
public GitHubApi(final GitHubExtension gitHubExtension) {
    this.gitHubExtension = gitHubExtension;

    org.slf4j.Logger gradleLogger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
    HttpLoggingInterceptor.Logger logger = gradleLogger::info;

    OkHttpClient okHttpClient = new OkHttpClient.Builder()
            .addInterceptor(new UserAgentInterceptor())
            .addInterceptor(new AuthInterceptor(gitHubExtension.getAuthToken()))
            .addInterceptor(new HttpLoggingInterceptor(logger).setLevel(HttpLoggingInterceptor.Level.BASIC))
            .build();

    String baseUrl = gitHubExtension.getRootUrl() + gitHubExtension.getRepoName() + "/";

    Retrofit retrofit = new Retrofit.Builder()
            .baseUrl(baseUrl)
            .client(okHttpClient)
            .addConverterFactory(DiffParserConverterFactory.create())
            .addConverterFactory(GsonConverterFactory.create())
            .build();

    gitHubApiClient = retrofit.create(GitHubApiClient.class);
}
 
開發者ID:btkelly,項目名稱:gnag,代碼行數:24,代碼來源:GitHubApi.java

示例8: DependencyConfigs

import org.gradle.api.logging.Logger; //導入依賴的package包/類
public DependencyConfigs(@Nonnull final Project pProject)
{
    project = pProject;
    buildUtil = new BuildUtil(pProject);
    depConfigDir = new File(pProject.getProjectDir(), "project/dependencyConfigs");
    final FileCollection listOfDepConfigFiles = readListOfDepConfigs(depConfigDir);
    depConfigs = readAllDependencyVersions(listOfDepConfigFiles);

    if (getDefault() == null || !DEFAULT_NAME.equals(getDefault().getName()) || !getDefault().isDefaultConfig()) {
        throw new GradleException("corrupt default dependency configuration");
    }

    final Logger log = pProject.getLogger();
    log.lifecycle("Default Checkstyle version: " + getDefault().getCheckstyleBaseVersion());
    log.lifecycle("Active dependency configurations:");
    for (Map.Entry<String, DependencyConfig> entry : depConfigs.entrySet()) {
        DependencyConfig depConfig = entry.getValue();
        log.lifecycle("  - " + entry.getKey() + ": Checkstyle " + depConfig.getCheckstyleBaseVersion() //
            + ", Java " + depConfig.getJavaLevel() //
            + ", compatible: " + depConfig.getCompatibleCheckstyleVersions());
    }
}
 
開發者ID:checkstyle-addons,項目名稱:checkstyle-addons,代碼行數:23,代碼來源:DependencyConfigs.java

示例9: logHealth

import org.gradle.api.logging.Logger; //導入依賴的package包/類
public void logHealth(DaemonHealthStats stats, Logger logger) {
    if (Boolean.getBoolean(HEALTH_MESSAGE_PROPERTY)) {
        logger.lifecycle(stats.getHealthInfo());
    } else {
        //the default
        logger.info(stats.getHealthInfo());
    }
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:9,代碼來源:HealthLogger.java

示例10: GradleBuildComparison

import org.gradle.api.logging.Logger; //導入依賴的package包/類
public GradleBuildComparison(
        ComparableGradleBuildExecuter sourceBuildExecuter,
        ComparableGradleBuildExecuter targetBuildExecuter,
        Logger logger,
        ProgressLogger progressLogger,
        Gradle gradle) {
    this.sourceBuildExecuter = sourceBuildExecuter;
    this.targetBuildExecuter = targetBuildExecuter;
    this.logger = logger;
    this.progressLogger = progressLogger;
    this.gradle = gradle;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:13,代碼來源:GradleBuildComparison.java

示例11: getDaemon

import org.gradle.api.logging.Logger; //導入依賴的package包/類
@Override
public WorkerDaemon getDaemon(Class<? extends WorkerDaemonProtocol> serverImplementationClass, File workingDir, final DaemonForkOptions forkOptions) {
    return new WorkerDaemon() {
        public <T extends WorkSpec> WorkerDaemonResult execute(WorkerDaemonAction<T> compiler, T spec) {
            ClassLoader groovyClassLoader = classLoaderFactory.createIsolatedClassLoader(new DefaultClassPath(forkOptions.getClasspath()));
            GroovySystemLoader groovyLoader = groovySystemLoaderFactory.forClassLoader(groovyClassLoader);
            FilteringClassLoader.Spec filteredGroovySpec = new FilteringClassLoader.Spec();
            for (String packageName : forkOptions.getSharedPackages()) {
                filteredGroovySpec.allowPackage(packageName);
            }
            ClassLoader filteredGroovy = classLoaderFactory.createFilteringClassLoader(groovyClassLoader, filteredGroovySpec);

            FilteringClassLoader.Spec loggingSpec = new FilteringClassLoader.Spec();
            loggingSpec.allowPackage("org.slf4j");
            loggingSpec.allowClass(Logger.class);
            loggingSpec.allowClass(LogLevel.class);
            ClassLoader loggingClassLoader = classLoaderFactory.createFilteringClassLoader(compiler.getClass().getClassLoader(), loggingSpec);

            ClassLoader groovyAndLoggingClassLoader = new CachingClassLoader(new MultiParentClassLoader(loggingClassLoader, filteredGroovy));

            ClassLoader workerClassLoader = new VisitableURLClassLoader(groovyAndLoggingClassLoader, ClasspathUtil.getClasspath(compiler.getClass().getClassLoader()));

            try {
                byte[] serializedWorker = GUtil.serialize(new Worker<T>(compiler, spec, gradleUserHomeDir));
                ClassLoaderObjectInputStream inputStream = new ClassLoaderObjectInputStream(new ByteArrayInputStream(serializedWorker), workerClassLoader);
                Callable<?> worker = (Callable<?>) inputStream.readObject();
                Object result = worker.call();
                byte[] serializedResult = GUtil.serialize(result);
                inputStream = new ClassLoaderObjectInputStream(new ByteArrayInputStream(serializedResult), getClass().getClassLoader());
                return (WorkerDaemonResult) inputStream.readObject();
            } catch (Exception e) {
                throw UncheckedException.throwAsUncheckedException(e);
            } finally {
                groovyLoader.shutdown();
            }
        }
    };
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:39,代碼來源:InProcessCompilerDaemonFactory.java

示例12: execute

import org.gradle.api.logging.Logger; //導入依賴的package包/類
static WorkResult execute(final Iterable<File> scalaClasspath, final Iterable<File> zincClasspath, File gradleUserHome, final ScalaJavaJointCompileSpec spec) {
    LOGGER.info("Compiling with Zinc Scala compiler.");

    final xsbti.Logger logger = new SbtLoggerAdapter();

    com.typesafe.zinc.Compiler compiler = ZincScalaCompilerFactory.createParallelSafeCompiler(scalaClasspath, zincClasspath, logger, gradleUserHome);

    List<String> scalacOptions = new ZincScalaCompilerArgumentsGenerator().generate(spec);
    List<String> javacOptions = new JavaCompilerArgumentsBuilder(spec).includeClasspath(false).build();
    Inputs inputs = Inputs.create(ImmutableList.copyOf(spec.getClasspath()), ImmutableList.copyOf(spec.getSource()), spec.getDestinationDir(),
            scalacOptions, javacOptions, spec.getScalaCompileOptions().getIncrementalOptions().getAnalysisFile(), spec.getAnalysisMap(), "mixed", getIncOptions(), true);
    if (LOGGER.isDebugEnabled()) {
        Inputs.debug(inputs, logger);
    }

    if (spec.getScalaCompileOptions().isForce()) {
        GFileUtils.deleteDirectory(spec.getDestinationDir());
    }

    try {
        compiler.compile(inputs, logger);
    } catch (xsbti.CompileFailed e) {
        throw new CompilationFailedException(e);
    }

    return new SimpleWorkResult(true);
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:28,代碼來源:ZincScalaCompiler.java

示例13: createParallelSafeCompiler

import org.gradle.api.logging.Logger; //導入依賴的package包/類
static Compiler createParallelSafeCompiler(final Iterable<File> scalaClasspath, final Iterable<File> zincClasspath, final xsbti.Logger logger, File gradleUserHome) {
    File zincCacheHomeDir = new File(System.getProperty(ZINC_CACHE_HOME_DIR_SYSTEM_PROPERTY, gradleUserHome.getAbsolutePath()));
    CacheRepository cacheRepository = ZincCompilerServices.getInstance(zincCacheHomeDir).get(CacheRepository.class);

    String zincVersion = Setup.zincVersion().published();
    String zincCacheKey = String.format("zinc-%s", zincVersion);
    String zincCacheName = String.format("Zinc %s compiler cache", zincVersion);
    final PersistentCache zincCache = cacheRepository.cache(zincCacheKey)
            .withDisplayName(zincCacheName)
            .withLockOptions(mode(FileLockManager.LockMode.Exclusive))
            .open();

    Compiler compiler;
    try {
        final File cacheDir = zincCache.getBaseDir();

        final String userSuppliedZincDir = System.getProperty("zinc.dir");
        if (userSuppliedZincDir != null && !userSuppliedZincDir.equals(cacheDir.getAbsolutePath())) {
            LOGGER.warn(ZINC_DIR_IGNORED_MESSAGE);
        }

        compiler = SystemProperties.getInstance().withSystemProperty(ZINC_DIR_SYSTEM_PROPERTY, cacheDir.getAbsolutePath(), new Factory<Compiler>() {
            @Override
            public Compiler create() {
                Setup zincSetup = createZincSetup(scalaClasspath, zincClasspath, logger);
                return createCompiler(zincSetup, zincCache, logger);
            }
        });
    } finally {
        zincCache.close();
    }

    return compiler;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:35,代碼來源:ZincScalaCompilerFactory.java

示例14: createCompiler

import org.gradle.api.logging.Logger; //導入依賴的package包/類
private static Compiler createCompiler(final Setup setup, final PersistentCache zincCache, final xsbti.Logger logger) {
    return Compiler.compilerCache().get(setup, new scala.runtime.AbstractFunction0<Compiler>() {
        public Compiler apply() {
            ScalaInstance instance = Compiler.scalaInstance(setup);
            File interfaceJar = getCompilerInterface(setup, instance, zincCache, logger);
            AnalyzingCompiler scalac = Compiler.newScalaCompiler(instance, interfaceJar, logger);
            JavaCompiler javac = Compiler.newJavaCompiler(instance, setup.javaHome(), setup.forkJava());
            return new Compiler(scalac, javac);
        }
    });
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:12,代碼來源:ZincScalaCompilerFactory.java

示例15: createZincSetup

import org.gradle.api.logging.Logger; //導入依賴的package包/類
private static Setup createZincSetup(Iterable<File> scalaClasspath, Iterable<File> zincClasspath, xsbti.Logger logger) {
    ScalaLocation scalaLocation = ScalaLocation.fromPath(Lists.newArrayList(scalaClasspath));
    SbtJars sbtJars = SbtJars.fromPath(Lists.newArrayList(zincClasspath));
    Setup setup = Setup.create(scalaLocation, sbtJars, Jvm.current().getJavaHome(), true);
    if (LOGGER.isDebugEnabled()) {
        Setup.debug(setup, logger);
    }
    return setup;
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:10,代碼來源:ZincScalaCompilerFactory.java


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