Java 类org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender 实例源码

项目:mongoose-base    文件:LogUtil.java   
public static void flushAll() {
    final LoggerContext logCtx = ((LoggerContext) LogManager.getContext());
    for(final org.apache.logging.log4j.core.Logger logger : logCtx.getLoggers()) {
        for(final Appender appender : logger.getAppenders().values()) {
            if(appender instanceof AbstractOutputStreamAppender) {
                ((AbstractOutputStreamAppender) appender).getManager().flush();
            }
        }
    }
}
项目:stochdiff    文件:CustomFileAppender.java   
public static void addFileAppender(String filename) {
    if (instance == null) {
        LOGGER.error("CustomFileAppender hasn't been initalized, ignoring output "
                     + filename);
        return;
    }

    final AbstractOutputStreamAppender<? extends OutputStreamManager> appender;
    if (mmap_appender)
        appender = MemoryMappedFileAppender.createAppender(filename,
                                                           "false", filename,
                                                           "false", "8192", "false",
                                                           instance.getLayout(),
                                                           instance.getFilter(),
                                                           "false", "false",
                                                           new DefaultConfiguration());
    else
        appender = FileAppender.createAppender(filename,
                                               "false", "false",
                                               filename,
                                               "false", "false",
                                               "true", "8192",
                                               instance.getLayout(),
                                               instance.getFilter(),
                                               "false", "false",
                                               new DefaultConfiguration());

    LOGGER.info("registering custom logfile '{}'", appender);
    instance.appenders.add(appender);
}