public class ScrapingSessionServerLog
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static Logger |
log
Used for logging.
|
Constructor and Description |
---|
ScrapingSessionServerLog(java.lang.String scrapingSessionLogName)
Constructs a new class by parsing the name of a scraping
session log.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getLog(java.lang.String filename)
Return the content of a given log file.
|
static java.lang.String |
getLog(java.lang.String filename,
boolean start,
int lines)
Returns a portion of the content of a given log file.
|
java.lang.String |
getLogFileName()
Gets the name of the log file.
|
java.lang.String |
getLogFileNameURLEncoded()
Gets the name of the log file as a URL-encoded string.
|
static java.lang.String |
getLogFolderPath()
Gets a string representation of the path to the
log folder.
|
static java.lang.String[] |
getLogNames()
Returns the names of all the files in the log directory of the remote server.
|
static long |
getLogSize(java.lang.String filename)
Return the size of the given logfile in bytes.
|
java.lang.String |
getScrapingSessionName()
Gets the name of the scraping session represented.
|
static java.util.ArrayList |
getScrapingSessionServerLogs()
Returns an
ArrayList of all
ScrapingSessionServerLog s. |
long |
getScrapingSessionStartTime()
Gets the time the scraping session started, as a long.
|
java.lang.String |
getScrapingSessionStartTimeFormatted()
Gets the time the scraping session started, as a
formatted date.
|
static boolean |
removeLog(java.lang.String filename)
Remove a log file from the log directory on the remote server.
|
public ScrapingSessionServerLog(java.lang.String scrapingSessionLogName)
scrapingSessionLogName
- The name of the scraping session log.public java.lang.String getScrapingSessionName()
public long getScrapingSessionStartTime()
public java.lang.String getLogFileName()
public java.lang.String getLogFileNameURLEncoded()
public java.lang.String getScrapingSessionStartTimeFormatted()
public static java.lang.String getLogFolderPath()
public static java.util.ArrayList getScrapingSessionServerLogs()
ArrayList
of all
ScrapingSessionServerLog
s.ArrayList
.@Nullable public static java.lang.String[] getLogNames()
null
if there is no log directory.public static long getLogSize(java.lang.String filename) throws java.io.IOException
filename
- the name of a file in the log directory.long
representing the length in bytes of this file, or 0 if the file does not exist or is empty.java.io.IOException
- An exception if the log file doesn't exist or can't be read.public static java.lang.String getLog(java.lang.String filename)
filename
- the name of the file to get the contents of.String
of the contents of the file, or "" if not possible.@Nullable public static java.lang.String getLog(java.lang.String filename, boolean start, int lines)
filename
- the name of a log file.start
- true
to return content from the beginning of a file, false
to start counting lines from the end.lines
- the number of lines from the log file to return.public static boolean removeLog(java.lang.String filename)
filename
- the name of the file to remove.