Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Network Health
Metrics
Library
Commits
d7d5303e
Commit
d7d5303e
authored
Mar 31, 2020
by
Karsten Loesing
Browse files
Simplify logging configuration.
Implements #33549.
parent
335b0244
Changes
11
Hide whitespace changes
Inline
Side-by-side
CHANGELOG.md
View file @
d7d5303e
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
*
Minor changes
*
Minor changes
-
Avoid invoking overridable methods from constructors.
-
Avoid invoking overridable methods from constructors.
-
Make all descriptor instances serializable.
-
Make all descriptor instances serializable.
-
Simplify logging configuration.
# Changes in version 2.10.0 - 2020-01-15
# Changes in version 2.10.0 - 2020-01-15
...
...
build
@
fd856466
Subproject commit
264e498f54a20f7d299daaf2533d043f880e6a8b
Subproject commit
fd856466bcb260f53ef69a24c102d0e49d171cc3
src/main/java/org/torproject/descriptor/DescriptorSourceFactory.java
View file @
d7d5303e
...
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
...
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
*/
*/
public
final
class
DescriptorSourceFactory
{
public
final
class
DescriptorSourceFactory
{
private
static
Logger
log
=
LoggerFactory
.
getLogger
(
private
static
final
Logger
log
ger
=
LoggerFactory
.
getLogger
(
DescriptorSourceFactory
.
class
);
DescriptorSourceFactory
.
class
);
/**
/**
...
@@ -147,7 +147,7 @@ public final class DescriptorSourceFactory {
...
@@ -147,7 +147,7 @@ public final class DescriptorSourceFactory {
}
}
object
=
ClassLoader
.
getSystemClassLoader
().
loadClass
(
clazzName
)
object
=
ClassLoader
.
getSystemClassLoader
().
loadClass
(
clazzName
)
.
getDeclaredConstructor
().
newInstance
();
.
getDeclaredConstructor
().
newInstance
();
log
.
info
(
"Serving implementation {} for {}."
,
clazzName
,
type
);
log
ger
.
debug
(
"Serving implementation {} for {}."
,
clazzName
,
type
);
}
catch
(
ReflectiveOperationException
ex
)
{
}
catch
(
ReflectiveOperationException
ex
)
{
throw
new
RuntimeException
(
"Cannot load class "
throw
new
RuntimeException
(
"Cannot load class "
+
clazzName
+
"for type "
+
type
,
ex
);
+
clazzName
+
"for type "
+
type
,
ex
);
...
...
src/main/java/org/torproject/descriptor/impl/DescriptorParserImpl.java
View file @
d7d5303e
...
@@ -23,7 +23,7 @@ import java.util.List;
...
@@ -23,7 +23,7 @@ import java.util.List;
public
class
DescriptorParserImpl
implements
DescriptorParser
{
public
class
DescriptorParserImpl
implements
DescriptorParser
{
private
static
final
Logger
log
private
static
final
Logger
log
ger
=
LoggerFactory
.
getLogger
(
DescriptorParserImpl
.
class
);
=
LoggerFactory
.
getLogger
(
DescriptorParserImpl
.
class
);
@Override
@Override
...
@@ -33,7 +33,7 @@ public class DescriptorParserImpl implements DescriptorParser {
...
@@ -33,7 +33,7 @@ public class DescriptorParserImpl implements DescriptorParser {
return
this
.
detectTypeAndParseDescriptors
(
rawDescriptorBytes
,
return
this
.
detectTypeAndParseDescriptors
(
rawDescriptorBytes
,
sourceFile
,
fileName
);
sourceFile
,
fileName
);
}
catch
(
DescriptorParseException
e
)
{
}
catch
(
DescriptorParseException
e
)
{
log
.
debug
(
"Cannot parse descriptor file '{}'."
,
sourceFile
,
e
);
log
ger
.
debug
(
"Cannot parse descriptor file '{}'."
,
sourceFile
,
e
);
List
<
Descriptor
>
parsedDescriptors
=
new
ArrayList
<>();
List
<
Descriptor
>
parsedDescriptors
=
new
ArrayList
<>();
parsedDescriptors
.
add
(
new
UnparseableDescriptorImpl
(
rawDescriptorBytes
,
parsedDescriptors
.
add
(
new
UnparseableDescriptorImpl
(
rawDescriptorBytes
,
new
int
[]
{
0
,
rawDescriptorBytes
.
length
},
sourceFile
,
e
));
new
int
[]
{
0
,
rawDescriptorBytes
.
length
},
sourceFile
,
e
));
...
...
src/main/java/org/torproject/descriptor/impl/DescriptorReaderImpl.java
View file @
d7d5303e
...
@@ -36,11 +36,9 @@ import java.util.TreeMap;
...
@@ -36,11 +36,9 @@ import java.util.TreeMap;
public
class
DescriptorReaderImpl
implements
DescriptorReader
{
public
class
DescriptorReaderImpl
implements
DescriptorReader
{
private
static
Logger
log
=
LoggerFactory
.
getLogger
(
private
static
final
Logger
log
ger
=
LoggerFactory
.
getLogger
(
DescriptorReaderImpl
.
class
);
DescriptorReaderImpl
.
class
);
private
static
Logger
statisticsLog
=
LoggerFactory
.
getLogger
(
"statistics"
);
private
boolean
hasStartedReading
=
false
;
private
boolean
hasStartedReading
=
false
;
private
File
manualSaveHistoryFile
;
private
File
manualSaveHistoryFile
;
...
@@ -161,8 +159,8 @@ public class DescriptorReaderImpl implements DescriptorReader {
...
@@ -161,8 +159,8 @@ public class DescriptorReaderImpl implements DescriptorReader {
this
.
readTarballs
();
this
.
readTarballs
();
this
.
hasFinishedReading
=
true
;
this
.
hasFinishedReading
=
true
;
}
catch
(
Throwable
t
)
{
}
catch
(
Throwable
t
)
{
log
.
error
(
"Bug: uncaught exception or error while reading
descriptors."
,
log
ger
.
error
(
"Bug: uncaught exception or error while reading
"
t
);
+
"descriptors."
,
t
);
}
finally
{
}
finally
{
if
(
null
!=
this
.
descriptorQueue
)
{
if
(
null
!=
this
.
descriptorQueue
)
{
this
.
descriptorQueue
.
setOutOfDescriptors
();
this
.
descriptorQueue
.
setOutOfDescriptors
();
...
@@ -180,7 +178,7 @@ public class DescriptorReaderImpl implements DescriptorReader {
...
@@ -180,7 +178,7 @@ public class DescriptorReaderImpl implements DescriptorReader {
StandardCharsets
.
UTF_8
);
StandardCharsets
.
UTF_8
);
for
(
String
line
:
lines
)
{
for
(
String
line
:
lines
)
{
if
(!
line
.
contains
(
" "
))
{
if
(!
line
.
contains
(
" "
))
{
log
.
warn
(
"Unexpected line structure in old history: {}"
,
line
);
log
ger
.
warn
(
"Unexpected line structure in old history: {}"
,
line
);
continue
;
continue
;
}
}
long
lastModifiedMillis
=
Long
.
parseLong
(
line
.
substring
(
0
,
long
lastModifiedMillis
=
Long
.
parseLong
(
line
.
substring
(
0
,
...
@@ -189,7 +187,7 @@ public class DescriptorReaderImpl implements DescriptorReader {
...
@@ -189,7 +187,7 @@ public class DescriptorReaderImpl implements DescriptorReader {
this
.
excludedFilesBefore
.
put
(
absolutePath
,
lastModifiedMillis
);
this
.
excludedFilesBefore
.
put
(
absolutePath
,
lastModifiedMillis
);
}
}
}
catch
(
IOException
|
NumberFormatException
e
)
{
}
catch
(
IOException
|
NumberFormatException
e
)
{
log
.
warn
(
"Trouble reading given history file {}."
,
historyFile
,
e
);
log
ger
.
warn
(
"Trouble reading given history file {}."
,
historyFile
,
e
);
}
}
}
}
...
@@ -212,7 +210,7 @@ public class DescriptorReaderImpl implements DescriptorReader {
...
@@ -212,7 +210,7 @@ public class DescriptorReaderImpl implements DescriptorReader {
bw
.
newLine
();
bw
.
newLine
();
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
log
.
warn
(
"Trouble writing new history file '{}'."
,
log
ger
.
warn
(
"Trouble writing new history file '{}'."
,
historyFile
,
e
);
historyFile
,
e
);
}
}
}
}
...
@@ -250,7 +248,7 @@ public class DescriptorReaderImpl implements DescriptorReader {
...
@@ -250,7 +248,7 @@ public class DescriptorReaderImpl implements DescriptorReader {
}
}
this
.
parsedFilesAfter
.
put
(
absolutePath
,
lastModifiedMillis
);
this
.
parsedFilesAfter
.
put
(
absolutePath
,
lastModifiedMillis
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
log
.
warn
(
"Unable to read descriptor file {}."
,
file
,
e
);
log
ger
.
warn
(
"Unable to read descriptor file {}."
,
file
,
e
);
}
}
}
}
}
}
...
@@ -271,13 +269,13 @@ public class DescriptorReaderImpl implements DescriptorReader {
...
@@ -271,13 +269,13 @@ public class DescriptorReaderImpl implements DescriptorReader {
this
.
parsedFilesAfter
.
put
(
tarball
.
getAbsolutePath
(),
this
.
parsedFilesAfter
.
put
(
tarball
.
getAbsolutePath
(),
tarball
.
lastModified
());
tarball
.
lastModified
());
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
log
.
warn
(
"Unable to read tarball {}."
,
tarball
,
e
);
log
ger
.
warn
(
"Unable to read tarball {}."
,
tarball
,
e
);
}
}
long
previousPercentDone
=
100L
*
progress
/
total
;
long
previousPercentDone
=
100L
*
progress
/
total
;
progress
+=
tarball
.
length
();
progress
+=
tarball
.
length
();
long
percentDone
=
100L
*
progress
/
total
;
long
percentDone
=
100L
*
progress
/
total
;
if
(
percentDone
>
previousPercentDone
)
{
if
(
percentDone
>
previousPercentDone
)
{
statisticsLog
.
info
(
"Finished reading {}% of tarball bytes."
,
logger
.
info
(
"Finished reading {}% of tarball bytes."
,
percentDone
);
percentDone
);
}
}
}
}
...
...
src/main/java/org/torproject/descriptor/index/DescriptorIndexCollector.java
View file @
d7d5303e
...
@@ -30,7 +30,7 @@ import java.util.TreeMap;
...
@@ -30,7 +30,7 @@ import java.util.TreeMap;
*/
*/
public
class
DescriptorIndexCollector
implements
DescriptorCollector
{
public
class
DescriptorIndexCollector
implements
DescriptorCollector
{
private
static
Logger
log
=
LoggerFactory
private
static
final
Logger
log
ger
=
LoggerFactory
.
getLogger
(
DescriptorIndexCollector
.
class
);
.
getLogger
(
DescriptorIndexCollector
.
class
);
/**
/**
...
@@ -44,7 +44,7 @@ public class DescriptorIndexCollector implements DescriptorCollector {
...
@@ -44,7 +44,7 @@ public class DescriptorIndexCollector implements DescriptorCollector {
public
void
collectDescriptors
(
String
collecTorIndexUrlString
,
public
void
collectDescriptors
(
String
collecTorIndexUrlString
,
String
[]
remoteDirectories
,
long
minLastModified
,
String
[]
remoteDirectories
,
long
minLastModified
,
File
localDirectory
,
boolean
deleteExtraneousLocalFiles
)
{
File
localDirectory
,
boolean
deleteExtraneousLocalFiles
)
{
log
.
info
(
"Starting descriptor collection."
);
log
ger
.
info
(
"Starting descriptor collection."
);
if
(
minLastModified
<
0
)
{
if
(
minLastModified
<
0
)
{
throw
new
IllegalArgumentException
(
"A negative minimum "
throw
new
IllegalArgumentException
(
"A negative minimum "
+
"last-modified time is not permitted."
);
+
"last-modified time is not permitted."
);
...
@@ -60,7 +60,8 @@ public class DescriptorIndexCollector implements DescriptorCollector {
...
@@ -60,7 +60,8 @@ public class DescriptorIndexCollector implements DescriptorCollector {
+
"fetched files. Move this file away or delete it. Aborting "
+
"fetched files. Move this file away or delete it. Aborting "
+
"descriptor collection."
);
+
"descriptor collection."
);
}
}
log
.
info
(
"Indexing local directory {}."
,
localDirectory
.
getAbsolutePath
());
logger
.
info
(
"Indexing local directory {}."
,
localDirectory
.
getAbsolutePath
());
SortedMap
<
String
,
Long
>
localFiles
=
statLocalDirectory
(
localDirectory
);
SortedMap
<
String
,
Long
>
localFiles
=
statLocalDirectory
(
localDirectory
);
SortedMap
<
String
,
FileNode
>
remoteFiles
;
SortedMap
<
String
,
FileNode
>
remoteFiles
;
IndexNode
index
;
IndexNode
index
;
...
@@ -71,27 +72,27 @@ public class DescriptorIndexCollector implements DescriptorCollector {
...
@@ -71,27 +72,27 @@ public class DescriptorIndexCollector implements DescriptorCollector {
if
(
indexUrl
.
getPath
().
isEmpty
())
{
if
(
indexUrl
.
getPath
().
isEmpty
())
{
indexUrlString
+=
"/index/index.json"
;
indexUrlString
+=
"/index/index.json"
;
}
}
log
.
info
(
"Fetching remote index file {}."
,
indexUrlString
);
log
ger
.
info
(
"Fetching remote index file {}."
,
indexUrlString
);
index
=
IndexNode
.
fetchIndex
(
indexUrlString
);
index
=
IndexNode
.
fetchIndex
(
indexUrlString
);
remoteFiles
=
index
.
retrieveFilesIn
(
remoteDirectories
);
remoteFiles
=
index
.
retrieveFilesIn
(
remoteDirectories
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
log
.
warn
(
"Cannot fetch index file {} and hence cannot determine which "
log
ger
.
warn
(
"Cannot fetch index file {} and hence cannot determine which "
+
"remote files to fetch. Aborting descriptor collection."
,
+
"remote files to fetch. Aborting descriptor collection."
,
indexUrlString
,
ex
);
indexUrlString
,
ex
);
return
;
return
;
}
}
log
.
info
(
"Fetching remote files from {}."
,
index
.
path
);
log
ger
.
info
(
"Fetching remote files from {}."
,
index
.
path
);
if
(!
this
.
fetchRemoteFiles
(
index
.
path
,
remoteFiles
,
minLastModified
,
if
(!
this
.
fetchRemoteFiles
(
index
.
path
,
remoteFiles
,
minLastModified
,
localDirectory
,
localFiles
))
{
localDirectory
,
localFiles
))
{
return
;
return
;
}
}
if
(
deleteExtraneousLocalFiles
)
{
if
(
deleteExtraneousLocalFiles
)
{
log
.
info
(
"Deleting extraneous files from local directory {}."
,
log
ger
.
info
(
"Deleting extraneous files from local directory {}."
,
localDirectory
);
localDirectory
);
deleteExtraneousLocalFiles
(
remoteDirectories
,
remoteFiles
,
localDirectory
,
deleteExtraneousLocalFiles
(
remoteDirectories
,
remoteFiles
,
localDirectory
,
localFiles
);
localFiles
);
}
}
log
.
info
(
"Finished descriptor collection."
);
log
ger
.
info
(
"Finished descriptor collection."
);
}
}
boolean
fetchRemoteFiles
(
String
baseUrl
,
SortedMap
<
String
,
FileNode
>
remotes
,
boolean
fetchRemoteFiles
(
String
baseUrl
,
SortedMap
<
String
,
FileNode
>
remotes
,
...
@@ -108,14 +109,15 @@ public class DescriptorIndexCollector implements DescriptorCollector {
...
@@ -108,14 +109,15 @@ public class DescriptorIndexCollector implements DescriptorCollector {
continue
;
continue
;
}
}
if
(!
filepath
.
exists
()
&&
!
filepath
.
mkdirs
())
{
if
(!
filepath
.
exists
()
&&
!
filepath
.
mkdirs
())
{
log
.
warn
(
"Cannot create local directory {} to store remote file {}.
"
log
ger
.
warn
(
"Cannot create local directory {} to store remote file {}. "
+
"Aborting descriptor collection."
,
filepath
,
filename
);
+
"Aborting descriptor collection."
,
filepath
,
filename
);
return
false
;
return
false
;
}
}
File
destinationFile
=
new
File
(
filepath
,
filename
);
File
destinationFile
=
new
File
(
filepath
,
filename
);
File
tempDestinationFile
=
new
File
(
filepath
,
"."
+
filename
);
File
tempDestinationFile
=
new
File
(
filepath
,
"."
+
filename
);
log
.
debug
(
"Fetching remote file {} with expected size of {} bytes from "
logger
.
debug
(
"Fetching remote file {} with expected size of {} bytes "
+
"{}, storing locally to temporary file {}, then renaming to {}."
,
+
"from {}, storing locally to temporary file {}, then renaming to "
+
"{}."
,
filepathname
,
entry
.
getValue
().
size
,
baseUrl
,
filepathname
,
entry
.
getValue
().
size
,
baseUrl
,
tempDestinationFile
.
getAbsolutePath
(),
tempDestinationFile
.
getAbsolutePath
(),
destinationFile
.
getAbsolutePath
());
destinationFile
.
getAbsolutePath
());
...
@@ -127,14 +129,14 @@ public class DescriptorIndexCollector implements DescriptorCollector {
...
@@ -127,14 +129,14 @@ public class DescriptorIndexCollector implements DescriptorCollector {
tempDestinationFile
.
renameTo
(
destinationFile
);
tempDestinationFile
.
renameTo
(
destinationFile
);
destinationFile
.
setLastModified
(
lastModifiedMillis
);
destinationFile
.
setLastModified
(
lastModifiedMillis
);
}
else
{
}
else
{
log
.
warn
(
"Fetched remote file {} from {} has a size of {} bytes "
log
ger
.
warn
(
"Fetched remote file {} from {} has a size of {} bytes "
+
"which is different from the expected {} bytes. Not storing "
+
"which is different from the expected {} bytes. Not storing "
+
"this file."
,
+
"this file."
,
filename
,
baseUrl
,
tempDestinationFile
.
length
(),
filename
,
baseUrl
,
tempDestinationFile
.
length
(),
entry
.
getValue
().
size
);
entry
.
getValue
().
size
);
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
log
.
warn
(
"Cannot fetch remote file {} from {}. Skipping that file."
,
log
ger
.
warn
(
"Cannot fetch remote file {} from {}. Skipping that file."
,
filename
,
baseUrl
,
e
);
filename
,
baseUrl
,
e
);
}
}
}
}
...
@@ -151,7 +153,7 @@ public class DescriptorIndexCollector implements DescriptorCollector {
...
@@ -151,7 +153,7 @@ public class DescriptorIndexCollector implements DescriptorCollector {
if
(
localPath
.
startsWith
(
remDir
))
{
if
(
localPath
.
startsWith
(
remDir
))
{
if
(!
remoteFiles
.
containsKey
(
localPath
))
{
if
(!
remoteFiles
.
containsKey
(
localPath
))
{
File
extraneousLocalFile
=
new
File
(
localDir
,
localPath
);
File
extraneousLocalFile
=
new
File
(
localDir
,
localPath
);
log
.
debug
(
"Deleting extraneous local file {}."
,
log
ger
.
debug
(
"Deleting extraneous local file {}."
,
extraneousLocalFile
.
getAbsolutePath
());
extraneousLocalFile
.
getAbsolutePath
());
extraneousLocalFile
.
delete
();
extraneousLocalFile
.
delete
();
}
}
...
@@ -179,8 +181,8 @@ public class DescriptorIndexCollector implements DescriptorCollector {
...
@@ -179,8 +181,8 @@ public class DescriptorIndexCollector implements DescriptorCollector {
}
}
});
});
}
catch
(
IOException
ioe
)
{
}
catch
(
IOException
ioe
)
{
log
.
warn
(
"Cannot index local directory {} to skip any remote files
that
"
log
ger
.
warn
(
"Cannot index local directory {} to skip any remote files "
+
"already exist locally.
Continuing with an either empty or "
+
"
that
already exist locally. Continuing with an either empty or "
+
"incomplete index of local files."
,
localDir
,
ioe
);
+
"incomplete index of local files."
,
localDir
,
ioe
);
}
}
return
locals
;
return
locals
;
...
...
src/main/java/org/torproject/descriptor/index/FileNode.java
View file @
d7d5303e
...
@@ -21,7 +21,7 @@ import java.util.TimeZone;
...
@@ -21,7 +21,7 @@ import java.util.TimeZone;
*/
*/
public
class
FileNode
implements
Comparable
<
FileNode
>
{
public
class
FileNode
implements
Comparable
<
FileNode
>
{
private
static
Logger
log
=
LoggerFactory
.
getLogger
(
FileNode
.
class
);
private
static
final
Logger
log
ger
=
LoggerFactory
.
getLogger
(
FileNode
.
class
);
/** Path (i.e. file name) is exposed in JSON. */
/** Path (i.e. file name) is exposed in JSON. */
public
final
String
path
;
public
final
String
path
;
...
@@ -70,9 +70,9 @@ public class FileNode implements Comparable<FileNode> {
...
@@ -70,9 +70,9 @@ public class FileNode implements Comparable<FileNode> {
try
{
try
{
lastModifiedMillis
=
dateTimeFormat
.
parse
(
this
.
lastModified
).
getTime
();
lastModifiedMillis
=
dateTimeFormat
.
parse
(
this
.
lastModified
).
getTime
();
}
catch
(
ParseException
ex
)
{
}
catch
(
ParseException
ex
)
{
log
.
warn
(
"Cannot parse last-modified time {} of remote file entry
{}.
"
log
ger
.
warn
(
"Cannot parse last-modified time {} of remote file entry "
+
"Fetching remote file regardless of configured last-modified "
+
"
{}.
Fetching remote file regardless of configured last-modified "
+
"time.
The following error message provides more details."
,
+
"time. The following error message provides more details."
,
this
.
lastModified
,
this
.
path
,
ex
);
this
.
lastModified
,
this
.
path
,
ex
);
this
.
lastModifiedMillis
=
-
1L
;
this
.
lastModifiedMillis
=
-
1L
;
}
}
...
...
src/main/java/org/torproject/descriptor/index/IndexNode.java
View file @
d7d5303e
...
@@ -14,9 +14,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
...
@@ -14,9 +14,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.PropertyNamingStrategy
;
import
com.fasterxml.jackson.databind.PropertyNamingStrategy
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
...
@@ -39,8 +36,6 @@ import java.util.TreeSet;
...
@@ -39,8 +36,6 @@ import java.util.TreeSet;
@JsonPropertyOrder
({
"created"
,
"revision"
,
"path"
,
"directories"
,
"files"
})
@JsonPropertyOrder
({
"created"
,
"revision"
,
"path"
,
"directories"
,
"files"
})
public
class
IndexNode
{
public
class
IndexNode
{
private
static
Logger
log
=
LoggerFactory
.
getLogger
(
IndexNode
.
class
);
private
static
final
int
READ_TIMEOUT
=
Integer
.
parseInt
(
System
private
static
final
int
READ_TIMEOUT
=
Integer
.
parseInt
(
System
.
getProperty
(
"sun.net.client.defaultReadTimeout"
,
"60000"
));
.
getProperty
(
"sun.net.client.defaultReadTimeout"
,
"60000"
));
...
...
src/main/java/org/torproject/descriptor/log/LogDescriptorImpl.java
View file @
d7d5303e
...
@@ -8,9 +8,6 @@ import org.torproject.descriptor.DescriptorParseException;
...
@@ -8,9 +8,6 @@ import org.torproject.descriptor.DescriptorParseException;
import
org.torproject.descriptor.LogDescriptor
;
import
org.torproject.descriptor.LogDescriptor
;
import
org.torproject.descriptor.internal.FileType
;
import
org.torproject.descriptor.internal.FileType
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayInputStream
;
import
java.io.File
;
import
java.io.File
;
...
@@ -37,9 +34,6 @@ public abstract class LogDescriptorImpl
...
@@ -37,9 +34,6 @@ public abstract class LogDescriptorImpl
private
static
final
int
unrecognizedLinesLimit
=
3
;
private
static
final
int
unrecognizedLinesLimit
=
3
;
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
LogDescriptorImpl
.
class
);
private
static
Pattern
filenamePattern
=
Pattern
.
compile
(
private
static
Pattern
filenamePattern
=
Pattern
.
compile
(
"(?:\\S*)"
+
MARKER
+
SEP
+
"(?:[0-9a-zA-Z]*)(?:\\.?)([a-zA-Z2]*)"
);
"(?:\\S*)"
+
MARKER
+
SEP
+
"(?:[0-9a-zA-Z]*)(?:\\.?)([a-zA-Z2]*)"
);
...
...
src/main/java/org/torproject/descriptor/log/WebServerAccessLogImpl.java
View file @
d7d5303e
...
@@ -7,9 +7,6 @@ import org.torproject.descriptor.DescriptorParseException;
...
@@ -7,9 +7,6 @@ import org.torproject.descriptor.DescriptorParseException;
import
org.torproject.descriptor.WebServerAccessLog
;
import
org.torproject.descriptor.WebServerAccessLog
;
import
org.torproject.descriptor.internal.FileType
;
import
org.torproject.descriptor.internal.FileType
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.io.BufferedReader
;
import
java.io.BufferedReader
;
import
java.io.File
;
import
java.io.File
;
import
java.io.InputStreamReader
;
import
java.io.InputStreamReader
;
...
@@ -35,9 +32,6 @@ public class WebServerAccessLogImpl extends LogDescriptorImpl
...
@@ -35,9 +32,6 @@ public class WebServerAccessLogImpl extends LogDescriptorImpl
private
static
final
long
serialVersionUID
=
7528914359452568309L
;
private
static
final
long
serialVersionUID
=
7528914359452568309L
;
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
WebServerAccessLogImpl
.
class
);
/** The log's name should include this string. */
/** The log's name should include this string. */
public
static
final
String
MARKER
=
InternalWebServerAccessLog
.
MARKER
;
public
static
final
String
MARKER
=
InternalWebServerAccessLog
.
MARKER
;
...
...
src/main/java/org/torproject/descriptor/log/WebServerAccessLogLine.java
View file @
d7d5303e
...
@@ -25,7 +25,7 @@ public class WebServerAccessLogLine implements WebServerAccessLog.Line {
...
@@ -25,7 +25,7 @@ public class WebServerAccessLogLine implements WebServerAccessLog.Line {
private
static
final
long
serialVersionUID
=
6160416810587561460L
;
private
static
final
long
serialVersionUID
=
6160416810587561460L
;
private
static
final
Logger
log
=
LoggerFactory
private
static
final
Logger
log
ger
=
LoggerFactory
.
getLogger
(
WebServerAccessLogLine
.
class
);
.
getLogger
(
WebServerAccessLogLine
.
class
);
private
static
final
String
DATE_PATTERN
=
"dd/MMM/yyyy"
;
private
static
final
String
DATE_PATTERN
=
"dd/MMM/yyyy"
;
...
@@ -153,7 +153,7 @@ public class WebServerAccessLogLine implements WebServerAccessLog.Line {
...
@@ -153,7 +153,7 @@ public class WebServerAccessLogLine implements WebServerAccessLog.Line {
res
.
valid
=
true
;
res
.
valid
=
true
;
}
}
}
catch
(
Throwable
th
)
{
}
catch
(
Throwable
th
)
{
log
.
debug
(
"Unmatchable line: '{}'."
,
line
,
th
);
log
ger
.
debug
(
"Unmatchable line: '{}'."
,
line
,
th
);
return
new
WebServerAccessLogLine
();
return
new
WebServerAccessLogLine
();
}
}
return
res
;
return
res
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment