use of org.gradle.api.logging.LogLevel in project gradle by gradle.
the class ResolveBuildCacheKeyExecuter method doResolve.
private TaskOutputCachingBuildCacheKey doResolve(TaskInternal task, TaskExecutionContext context) {
TaskArtifactState taskState = context.getTaskArtifactState();
TaskOutputCachingBuildCacheKey cacheKey = taskState.calculateCacheKey();
if (context.getTaskProperties().hasDeclaredOutputs()) {
// A task with no outputs and no cache key.
if (cacheKey.isValid()) {
LogLevel logLevel = buildCacheDebugLogging ? LogLevel.LIFECYCLE : LogLevel.INFO;
LOGGER.log(logLevel, "Build cache key for {} is {}", task, cacheKey.getHashCode());
}
}
return cacheKey;
}
use of org.gradle.api.logging.LogLevel in project gradle by gradle.
the class ProviderConnection method configure.
public void configure(ProviderConnectionParameters parameters, GradleVersion consumerVersion) {
this.consumerVersion = consumerVersion;
LogLevel providerLogLevel = parameters.getVerboseLogging() ? LogLevel.DEBUG : LogLevel.INFO;
LOGGER.debug("Configuring logging to level: {}", providerLogLevel);
LoggingManagerInternal loggingManager = sharedServices.newInstance(LoggingManagerInternal.class);
loggingManager.setLevelInternal(providerLogLevel);
loggingManager.start();
}
use of org.gradle.api.logging.LogLevel in project gradle by gradle.
the class AntLoggingAdapter method messageLogged.
@Override
public void messageLogged(BuildEvent event) {
final StringBuffer message = new StringBuffer();
if (event.getTask() != null) {
String taskName = event.getTask().getTaskName();
message.append("[ant:").append(taskName).append("] ");
}
final String messageText = event.getMessage();
message.append(messageText);
LogLevel level = getLogLevelForMessagePriority(event.getPriority());
if (event.getException() != null) {
logger.log(level, message.toString(), event.getException());
} else {
logger.log(level, message.toString());
}
}
use of org.gradle.api.logging.LogLevel in project gradle by gradle.
the class AbstractTestTask method executeTests.
@TaskAction
public void executeTests() {
LogLevel currentLevel = determineCurrentLogLevel();
TestLogging levelLogging = getTestLogging().get(currentLevel);
TestExceptionFormatter exceptionFormatter = getExceptionFormatter(levelLogging);
TestEventLogger eventLogger = new TestEventLogger(getTextOutputFactory(), currentLevel, levelLogging, exceptionFormatter);
addTestListener(eventLogger);
addTestOutputListener(eventLogger);
TestExecutionSpec executionSpec = createTestExecutionSpec();
final File binaryResultsDir = getBinaryResultsDirectory().getAsFile().get();
FileSystemOperations fs = getFileSystemOperations();
fs.delete(new Action<DeleteSpec>() {
@Override
public void execute(DeleteSpec spec) {
spec.delete(binaryResultsDir);
}
});
binaryResultsDir.mkdirs();
Map<String, TestClassResult> results = new HashMap<String, TestClassResult>();
TestOutputStore testOutputStore = new TestOutputStore(binaryResultsDir);
TestOutputStore.Writer outputWriter = testOutputStore.writer();
TestReportDataCollector testReportDataCollector = new TestReportDataCollector(results, outputWriter);
addTestListener(testReportDataCollector);
addTestOutputListener(testReportDataCollector);
TestCountLogger testCountLogger = new TestCountLogger(getProgressLoggerFactory());
addTestListener(testCountLogger);
getTestListenerInternalBroadcaster().add(new TestListenerAdapter(testListenerBroadcaster.getSource(), getTestOutputListenerBroadcaster().getSource()));
ProgressLogger parentProgressLogger = getProgressLoggerFactory().newOperation(AbstractTestTask.class);
parentProgressLogger.setDescription("Test Execution");
parentProgressLogger.started();
TestWorkerProgressListener testWorkerProgressListener = new TestWorkerProgressListener(getProgressLoggerFactory(), parentProgressLogger);
getTestListenerInternalBroadcaster().add(testWorkerProgressListener);
TestExecuter<TestExecutionSpec> testExecuter = Cast.uncheckedNonnullCast(createTestExecuter());
TestListenerInternal resultProcessorDelegate = getTestListenerInternalBroadcaster().getSource();
if (failFast) {
resultProcessorDelegate = new FailFastTestListenerInternal(testExecuter, resultProcessorDelegate);
}
TestResultProcessor resultProcessor = new StateTrackingTestResultProcessor(resultProcessorDelegate);
try {
testExecuter.execute(executionSpec, resultProcessor);
} finally {
parentProgressLogger.completed();
testWorkerProgressListener.completeAll();
testListenerBroadcaster.removeAll();
getTestOutputListenerBroadcaster().removeAll();
getTestListenerInternalBroadcaster().removeAll();
outputWriter.close();
}
new TestResultSerializer(binaryResultsDir).write(results.values());
createReporting(results, testOutputStore);
handleCollectedResults(testCountLogger);
}
use of org.gradle.api.logging.LogLevel in project gradle by gradle.
the class OutputEventRenderer method onOutput.
@Override
public void onOutput(OutputEvent event) {
if (event.getLogLevel() != null && event.getLogLevel().compareTo(logLevel.get()) < 0 && !isProgressEvent(event)) {
return;
}
if (event instanceof LogLevelChangeEvent) {
LogLevelChangeEvent changeEvent = (LogLevelChangeEvent) event;
LogLevel newLogLevel = changeEvent.getNewLogLevel();
if (newLogLevel == this.logLevel.get()) {
return;
}
this.logLevel.set(newLogLevel);
}
synchronized (lock) {
transformer.onOutput(event);
}
}
Aggregations