Search in sources :

Example 1 with LogManager

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());
    }
}
Also used : Config(com.typesafe.config.Config) LogManager(com.datastax.oss.dsbulk.workflow.commons.log.LogManager) Test(org.junit.jupiter.api.Test)

Example 2 with LogManager

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());
    }
}
Also used : Config(com.typesafe.config.Config) LogManager(com.datastax.oss.dsbulk.workflow.commons.log.LogManager) Test(org.junit.jupiter.api.Test)

Example 3 with LogManager

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);
}
Also used : RowFormatter(com.datastax.oss.dsbulk.format.row.RowFormatter) StatementFormatter(com.datastax.oss.dsbulk.format.statement.StatementFormatter) MappedBoundStatementPrinter(com.datastax.oss.dsbulk.workflow.commons.format.statement.MappedBoundStatementPrinter) LogManager(com.datastax.oss.dsbulk.workflow.commons.log.LogManager)

Aggregations

LogManager (com.datastax.oss.dsbulk.workflow.commons.log.LogManager)3 Config (com.typesafe.config.Config)2 Test (org.junit.jupiter.api.Test)2 RowFormatter (com.datastax.oss.dsbulk.format.row.RowFormatter)1 StatementFormatter (com.datastax.oss.dsbulk.format.statement.StatementFormatter)1 MappedBoundStatementPrinter (com.datastax.oss.dsbulk.workflow.commons.format.statement.MappedBoundStatementPrinter)1