Java 类io.dropwizard.logging.AppenderFactory 实例源码

项目:soabase    文件:SoaBundle.java   
private LoggingReader initLogging(Configuration configuration) throws IOException
{
    Set<File> mainFiles = Sets.newHashSet();
    Set<File> archiveDirectories = Sets.newHashSet();
    LoggingFactory loggingFactory = configuration.getLoggingFactory();
    if ( loggingFactory instanceof DefaultLoggingFactory )
    {
        for ( AppenderFactory appenderFactory : ((DefaultLoggingFactory)loggingFactory).getAppenders() )
        {
            if ( appenderFactory instanceof FileAppenderFactory )
            {
                FileAppenderFactory fileAppenderFactory = (FileAppenderFactory)appenderFactory;
                if ( fileAppenderFactory.getCurrentLogFilename() != null )
                {
                    mainFiles.add(new File(fileAppenderFactory.getCurrentLogFilename()).getCanonicalFile());
                }

                if ( fileAppenderFactory.getArchivedLogFilenamePattern() != null )
                {
                    File archive = new File(fileAppenderFactory.getArchivedLogFilenamePattern()).getParentFile().getCanonicalFile();
                    archiveDirectories.add(archive);
                }
            }
        }
    }

    if ( (mainFiles.size() == 0) && (archiveDirectories.size() == 0) )
    {
        log.warn("No log files found in config");
    }

    return new LoggingReader(mainFiles, archiveDirectories);
}
项目:dropwizard-heroku    文件:HerokuLoggingFactory.java   
/**
 * Creates the default appenders for a Heroku application.
 *
 * @return a single-element list containing a {@link #consoleAppender() console appender}.
 */
public static List<AppenderFactory> defaultAppenders() {
    return Lists.<AppenderFactory>newArrayList(
            consoleAppender()
    );

}
项目:dropwizard-heroku    文件:HerokuLoggingFactoryTest.java   
@Test
public void defaultHerokuConsoleAppenders() {
    ImmutableList<AppenderFactory> appenders = factory.getAppenders();
    assertThat(appenders.size(), is(1));
    assertThat(appenders.get(0), is(instanceOf(HerokuConsoleAppenderFactory.class)));
}