Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private StoreLogService(org.neo4j.logging.LogProvider userLogProvider, org.neo4j.io.fs.FileSystemAbstraction fileSystem, java.io.File internalLog, java.util.Map<String, org.neo4j.logging.Level> logLevels, org.neo4j.logging.Level defaultLevel, java.time.ZoneId logTimeZone, long internalLogRotationThreshold, long internalLogRotationDelay, int maxInternalLogArchives, java.util.concurrent.Executor rotationExecutor, final System.Action<org.neo4j.logging.LogProvider> rotationListener) throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        private StoreLogService(LogProvider userLogProvider, FileSystemAbstraction fileSystem, File internalLog, IDictionary <string, Level> logLevels, Level defaultLevel, ZoneId logTimeZone, long internalLogRotationThreshold, long internalLogRotationDelay, int maxInternalLogArchives, Executor rotationExecutor, System.Action <LogProvider> rotationListener)
        {
            if (!internalLog.ParentFile.exists())
            {
                fileSystem.Mkdirs(internalLog.ParentFile);
            }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.logging.FormattedLogProvider.Builder internalLogBuilder = org.neo4j.logging.FormattedLogProvider.withZoneId(logTimeZone).withDefaultLogLevel(defaultLevel).withLogLevels(logLevels);
            FormattedLogProvider.Builder internalLogBuilder = FormattedLogProvider.withZoneId(logTimeZone).withDefaultLogLevel(defaultLevel).withLogLevels(logLevels);

            FormattedLogProvider internalLogProvider;

            if (internalLogRotationThreshold == 0)
            {
                Stream outputStream = createOrOpenAsOutputStream(fileSystem, internalLog, true);
                internalLogProvider = internalLogBuilder.ToOutputStream(outputStream);
                rotationListener(internalLogProvider);
                this._closeable = outputStream;
            }
            else
            {
                RotatingFileOutputStreamSupplier rotatingSupplier = new RotatingFileOutputStreamSupplier(fileSystem, internalLog, internalLogRotationThreshold, internalLogRotationDelay, maxInternalLogArchives, rotationExecutor, new RotationListenerAnonymousInnerClass(this, rotationListener, internalLogBuilder));
                internalLogProvider = internalLogBuilder.ToOutputStream(rotatingSupplier);
                this._closeable     = rotatingSupplier;
            }
            this._logService = new SimpleLogService(userLogProvider, internalLogProvider);
        }
Пример #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void buildRotatingLog(long rotationThreshold, int maxArchives) throws java.io.IOException
        private void BuildRotatingLog(long rotationThreshold, int maxArchives)
        {
            RotatingFileOutputStreamSupplier rotatingSupplier = new RotatingFileOutputStreamSupplier(_fileSystem, _currentQueryLogFile, rotationThreshold, 0, maxArchives, _scheduler.executor(Group.LOG_ROTATION));

            _log      = _logBuilder.toOutputStream(rotatingSupplier);
            _closable = rotatingSupplier;
        }
Пример #3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void shutdown() throws Throwable
        public override void Shutdown()
        {
            if (this._rotatingSupplier != null)
            {
                this._rotatingSupplier.Dispose();
                this._rotatingSupplier = null;
            }
        }
Пример #4
0
            public override CsvRotatableWriter Apply(File file)
            {
                RotatingFileOutputStreamSupplier outputStreamSupplier = FileSupplierStreamCreator.apply(file, new HeaderWriterRotationListener(this));
                PrintWriter        printWriter = CreateWriter(outputStreamSupplier.Get());
                CsvRotatableWriter writer      = new CsvRotatableWriter(printWriter, outputStreamSupplier);

                WriteHeader(printWriter, Header);
                return(writer);
            }
Пример #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public AsyncRequestLog(org.neo4j.io.fs.FileSystemAbstraction fs, java.time.ZoneId logTimeZone, String logFile, long rotationSize, int rotationKeepNumber) throws java.io.IOException
        public AsyncRequestLog(FileSystemAbstraction fs, ZoneId logTimeZone, string logFile, long rotationSize, int rotationKeepNumber)
        {
            NamedThreadFactory threadFactory    = new NamedThreadFactory("HTTP-Log-Rotator", true);
            ExecutorService    rotationExecutor = Executors.newCachedThreadPool(threadFactory);

            _outputSupplier = new RotatingFileOutputStreamSupplier(fs, new File(logFile), rotationSize, 0, rotationKeepNumber, rotationExecutor);
            FormattedLogProvider logProvider = FormattedLogProvider.withZoneId(logTimeZone).toOutputStream(_outputSupplier);

            _asyncLogProcessingExecutor = Executors.newSingleThreadExecutor(new NamedThreadFactory("HTTP-Log-Writer"));
            _asyncEventProcessor        = new AsyncEvents <AsyncLogEvent>(this, this);
            AsyncLogProvider asyncLogProvider = new AsyncLogProvider(_asyncEventProcessor, logProvider);

            _log = asyncLogProvider.GetLog("REQUEST");
        }
Пример #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public SecurityLog(org.neo4j.kernel.configuration.Config config, org.neo4j.io.fs.FileSystemAbstraction fileSystem, java.util.concurrent.Executor executor) throws java.io.IOException
        public SecurityLog(Config config, FileSystemAbstraction fileSystem, Executor executor)
        {
            ZoneId logTimeZoneId = config.Get(GraphDatabaseSettings.db_timezone).ZoneId;
            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.Level = config.Get(SecuritySettings.security_log_level);

            this._inner = formattedLog;
        }
Пример #7
0
 internal CsvRotatableWriter(PrintWriter printWriter, RotatingFileOutputStreamSupplier streamSupplier)
 {
     this.PrintWriter    = printWriter;
     this.StreamSupplier = streamSupplier;
 }