use of com.datastax.oss.dsbulk.workflow.commons.log.LogManager in project dsbulk by datastax.
the class LogSettingsTest method should_create_log_manager_when_output_directory_path_provided.
@Test
void should_create_log_manager_when_output_directory_path_provided() throws Exception {
Config config = TestConfigUtils.createTestConfig("dsbulk.log", "directory", quoteJson(customLogsDirectory));
LogSettings settings = new LogSettings(config, executionId);
settings.init();
try (LogManager logManager = settings.newLogManager(session, true)) {
logManager.init();
assertThat(logManager).isNotNull();
assertThat(logManager.getOperationDirectory().toFile()).isEqualTo(customLogsDirectory.resolve(executionId).toFile());
}
}
use of com.datastax.oss.dsbulk.workflow.commons.log.LogManager in project dsbulk by datastax.
the class LogSettingsTest method should_create_log_manager_with_default_output_directory.
@Test
void should_create_log_manager_with_default_output_directory() throws Exception {
Config config = TestConfigUtils.createTestConfig("dsbulk.log");
LogSettings settings = new LogSettings(config, executionId);
settings.init();
try (LogManager logManager = settings.newLogManager(session, true)) {
logManager.init();
assertThat(logManager).isNotNull();
assertThat(logManager.getOperationDirectory().toFile().getAbsolutePath()).isEqualTo(defaultLogsDirectory.resolve(executionId).normalize().toFile().getAbsolutePath());
}
}
use of com.datastax.oss.dsbulk.workflow.commons.log.LogManager in project dsbulk by datastax.
the class LogSettings method newLogManager.
public LogManager newLogManager(CqlSession session, boolean trackPositions) {
StatementFormatter statementFormatter = StatementFormatter.builder().withMaxQueryStringLength(maxQueryStringLength).withMaxBoundValueLength(maxBoundValueLength).withMaxBoundValues(maxBoundValues).withMaxInnerStatements(maxInnerStatements).addStatementPrinters(new MappedBoundStatementPrinter()).build();
RowFormatter rowFormatter = new RowFormatter(maxResultSetValueLength, maxResultSetValues);
return new LogManager(session, operationDirectory, errorThreshold, queryWarningsThreshold, trackPositions, statementFormatter, level, rowFormatter);
}
Aggregations