예제 #1
0
        private void GetRaftLogs(IList <DiagnosticsReportSource> sources)
        {
            if (_clusterStateDirectory == null)
            {
                sources.Add(DiagnosticsReportSources.newDiagnosticsString("raft.txt", () => "error creating ClusterStateDirectory: " + _clusterStateException.Message));
                return;
            }

            File      raftLogDirectory             = new File(_clusterStateDirectory, RAFT_LOG_DIRECTORY_NAME);
            FileNames fileNames                    = new FileNames(raftLogDirectory);
            SortedDictionary <long, File> allFiles = fileNames.GetAllFiles(_fs, NullLog.Instance);

            foreach (File logFile in allFiles.Values)
            {
                sources.Add(DiagnosticsReportSources.newDiagnosticsFile("raft/" + logFile.Name, _fs, logFile));
            }
        }
예제 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.diagnostics.DiagnosticsReporter createAndRegisterSources() throws org.neo4j.commandline.admin.CommandFailed
        private DiagnosticsReporter CreateAndRegisterSources()
        {
            DiagnosticsReporter reporter = new DiagnosticsReporter();
            File   configFile            = _configDir.resolve(Config.DEFAULT_CONFIG_FILE_NAME).toFile();
            Config config = GetConfig(configFile);

            File storeDirectory = config.Get(database_path);

            reporter.RegisterAllOfflineProviders(config, storeDirectory, this._fs);

            // Register sources provided by this tool
            reporter.RegisterSource("config", DiagnosticsReportSources.newDiagnosticsFile("neo4j.conf", _fs, configFile));

            reporter.RegisterSource("ps", RunningProcesses());

            // Online connection
            RegisterJMXSources(reporter);
            return(reporter);
        }
예제 #3
0
        /// <summary>
        /// Add all files in a directory recursively.
        /// </summary>
        /// <param name="path"> current relative path for destination. </param>
        /// <param name="dir"> current directory or file. </param>
        /// <param name="sources"> list of source that will be accumulated. </param>
        private void AddDirectory(string path, File dir, IList <DiagnosticsReportSource> sources)
        {
            string currentLevel = path + File.separator + dir.Name;

            if (_fs.isDirectory(dir))
            {
                File[] files = _fs.listFiles(dir);
                if (files != null)
                {
                    foreach (File file in files)
                    {
                        AddDirectory(currentLevel, file, sources);
                    }
                }
            }
            else               // File
            {
                sources.Add(DiagnosticsReportSources.newDiagnosticsFile(currentLevel, _fs, dir));
            }
        }