use of com.spotify.helios.common.LoggingConfig in project helios by spotify.
the class SentryTest method testSentryAppender.
@Test
public void testSentryAppender() throws Exception {
// start our UDP server which will receive sentry messages
final UdpServer udpServer = new UdpServer(sentryPort);
// turn on logging which enables the sentry appender
final LoggingConfig config = new LoggingConfig(0, true, null, false);
ServiceMain.setupLogging(config, testDsn);
// log a message at error level so sentry appender sends it to UDP server
log.error("Ignore test message printed by Helios SentryTest");
// be nice and turn logging back off
LoggingConfigurator.configureNoLogging();
// make sure we got the message as expected, note that getMessage is a blocking method
final String message = udpServer.getMessage();
assertTrue("Expected message beginning with 'Sentry', instead got " + message, message.startsWith("Sentry"));
}
use of com.spotify.helios.common.LoggingConfig in project helios by spotify.
the class CliMain method setupLogging.
private void setupLogging() {
final LoggingConfig config = parser.getLoggingConfig();
if (config.getNoLogSetup()) {
return;
}
final int verbose = config.getVerbosity();
final Level level = get(asList(WARN, INFO, DEBUG, ALL), verbose, ALL);
final Logger rootLogger = (Logger) LoggerFactory.getLogger(ROOT_LOGGER_NAME);
rootLogger.setLevel(level);
}
Aggregations