예제 #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
 public RotationListenerAnonymousInnerClass(StoreLogService outerInstance, System.Action <LogProvider> rotationListener, FormattedLogProvider.Builder internalLogBuilder)
 {
     this.outerInstance       = outerInstance;
     this._rotationListener   = rotationListener;
     this._internalLogBuilder = internalLogBuilder;
 }