public SecurityLog( Config config, FileSystemAbstraction fileSystem, Executor executor ) throws IOException { ZoneId logTimeZoneId = config.get( GraphDatabaseSettings.db_timezone ).getZoneId(); File logFile = config.get( SecuritySettings.security_log_filename ); FormattedLog.Builder builder = FormattedLog.withZoneId( logTimeZoneId ); rotatingSupplier = new RotatingFileOutputStreamSupplier( fileSystem, logFile, config.get( SecuritySettings.store_security_log_rotation_threshold ), config.get( SecuritySettings.store_security_log_rotation_delay ).toMillis(), config.get( SecuritySettings.store_security_log_max_archives ), executor ); FormattedLog formattedLog = builder.toOutputStream( rotatingSupplier ); formattedLog.setLevel( config.get( SecuritySettings.security_log_level ) ); this.inner = formattedLog; }
private void buildNonRotatingLog() throws IOException { OutputStream logOutputStream = createOrOpenAsOutputStream( fileSystem, currentQueryLogFile, true ); log = logBuilder.toOutputStream( logOutputStream ); closable = logOutputStream; }
/** * Creates a {@link FormattedLog} instance that writes messages to {@link OutputStream}s obtained from the specified * {@link Supplier}. The OutputStream is obtained from the Supplier before every log message is written. * * @param outSupplier A supplier for an output stream to write to * @return A {@link FormattedLog} instance */ public static FormattedLog toOutputStream( Supplier<OutputStream> outSupplier ) { return new Builder().toOutputStream( outSupplier ); }
/** * Creates a {@link FormattedLog} instance that writes messages to an {@link OutputStream}. * * @param out An {@link OutputStream} to write to * @return A {@link FormattedLog} instance that writes to the specified OutputStream */ public static FormattedLog toOutputStream( OutputStream out ) { return new Builder().toOutputStream( out ); }
private void buildRotatingLog( long rotationThreshold, int maxArchives ) throws IOException { RotatingFileOutputStreamSupplier rotatingSupplier = new RotatingFileOutputStreamSupplier( fileSystem, currentQueryLogFile, rotationThreshold, 0, maxArchives, scheduler.executor( JobScheduler.Groups.queryLogRotation ) ); log = logBuilder.toOutputStream( rotatingSupplier ); closable = rotatingSupplier; }
@BeforeEach void setUp() { logger = FormattedLog.withLogLevel( debug ? Level.DEBUG : Level.NONE ).toOutputStream( System.out ); }
/** * Creates a {@link FormattedLog} instance that writes messages to an {@link OutputStream}. * * @param out An {@link OutputStream} to write to * @return A {@link FormattedLog} instance that writes to the specified OutputStream */ public static FormattedLog toOutputStream( OutputStream out ) { return new Builder().toOutputStream( out ); }
/** * Creates a {@link FormattedLog} instance that writes messages to {@link OutputStream}s obtained from the specified * {@link Supplier}. The OutputStream is obtained from the Supplier before every log message is written. * * @param outSupplier A supplier for an output stream to write to * @return A {@link FormattedLog} instance */ public static FormattedLog toOutputStream( Supplier<OutputStream> outSupplier ) { return new Builder().toOutputStream( outSupplier ); }