Package org.apache.solr.util
Class SolrCLI.UtilsTool
- java.lang.Object
-
- org.apache.solr.util.SolrCLI.ToolBase
-
- org.apache.solr.util.SolrCLI.UtilsTool
-
- All Implemented Interfaces:
SolrCLI.Tool
- Enclosing class:
- SolrCLI
public static class SolrCLI.UtilsTool extends SolrCLI.ToolBase
-
-
Field Summary
-
Fields inherited from class org.apache.solr.util.SolrCLI.ToolBase
stdout, verbose
-
-
Constructor Summary
Constructors Constructor Description UtilsTool()
UtilsTool(PrintStream stdout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
archiveConsoleLogs()
Moves console log(s) into archiced/int
archiveGcLogs()
Moves gc logs into archived/String
getName()
org.apache.commons.cli.Option[]
getOptions()
int
removeOldSolrLogs(int daysToKeep)
Deletes time-stamped old solr logs, if older than n daysint
rotateSolrLogs(int generations)
Rotates solr.log before starting Solr.protected void
runImpl(org.apache.commons.cli.CommandLine cli)
int
runTool(org.apache.commons.cli.CommandLine cli)
void
setLogPath(Path logsPath)
void
setQuiet(boolean shouldPrintStdout)
void
setServerPath(Path serverPath)
-
Methods inherited from class org.apache.solr.util.SolrCLI.ToolBase
echo, echoIfVerbose
-
-
-
-
Constructor Detail
-
UtilsTool
public UtilsTool()
-
UtilsTool
public UtilsTool(PrintStream stdout)
-
-
Method Detail
-
getName
public String getName()
-
getOptions
public org.apache.commons.cli.Option[] getOptions()
-
runTool
public int runTool(org.apache.commons.cli.CommandLine cli) throws Exception
- Specified by:
runTool
in interfaceSolrCLI.Tool
- Overrides:
runTool
in classSolrCLI.ToolBase
- Throws:
Exception
-
archiveGcLogs
public int archiveGcLogs() throws Exception
Moves gc logs into archived/- Returns:
- 0 on success
- Throws:
Exception
- on failure
-
archiveConsoleLogs
public int archiveConsoleLogs() throws Exception
Moves console log(s) into archiced/- Returns:
- 0 on success
- Throws:
Exception
- on failure
-
rotateSolrLogs
public int rotateSolrLogs(int generations) throws Exception
Rotates solr.log before starting Solr. Mimics log4j2 behavior, i.e. with generations=9:solr.log.9 (and higher) are deleted solr.log.8 -> solr.log.9 solr.log.7 -> solr.log.8 ... solr.log -> solr.log.1
- Parameters:
generations
- number of generations to keep. Should agree with setting in log4j2.xml- Returns:
- 0 if success
- Throws:
Exception
- if problems
-
removeOldSolrLogs
public int removeOldSolrLogs(int daysToKeep) throws Exception
Deletes time-stamped old solr logs, if older than n days- Parameters:
daysToKeep
- number of days logs to keep before deleting- Returns:
- 0 on success
- Throws:
Exception
- on failure
-
runImpl
protected void runImpl(org.apache.commons.cli.CommandLine cli) throws Exception
- Specified by:
runImpl
in classSolrCLI.ToolBase
- Throws:
Exception
-
setLogPath
public void setLogPath(Path logsPath)
-
setServerPath
public void setServerPath(Path serverPath)
-
setQuiet
public void setQuiet(boolean shouldPrintStdout)
-
-