|
|
|
@ -44,28 +44,23 @@ public class OssRemoteLogHandler implements RemoteLogHandler, Closeable {
|
|
|
|
|
private static OssRemoteLogHandler instance; |
|
|
|
|
|
|
|
|
|
private OssRemoteLogHandler() { |
|
|
|
|
String accessKeyId = readOssAccessKeyId(); |
|
|
|
|
String accessKeySecret = readOssAccessKeySecret(); |
|
|
|
|
String endpoint = readOssEndpoint(); |
|
|
|
|
ossClient = OssClientFactory.buildOssClient(new OssConnection(accessKeyId, accessKeySecret, endpoint)); |
|
|
|
|
|
|
|
|
|
bucketName = readOssBucketName(); |
|
|
|
|
checkBucketNameExists(bucketName); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static synchronized OssRemoteLogHandler getInstance() { |
|
|
|
|
if (instance == null) { |
|
|
|
|
instance = new OssRemoteLogHandler(); |
|
|
|
|
instance.init(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return instance; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void init() { |
|
|
|
|
String accessKeyId = readOssAccessKeyId(); |
|
|
|
|
String accessKeySecret = readOssAccessKeySecret(); |
|
|
|
|
String endpoint = readOssEndpoint(); |
|
|
|
|
ossClient = OssClientFactory.buildOssClient(new OssConnection(accessKeyId, accessKeySecret, endpoint)); |
|
|
|
|
|
|
|
|
|
bucketName = readOssBucketName(); |
|
|
|
|
checkBucketNameExists(bucketName); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void sendRemoteLog(String logPath) { |
|
|
|
|
String objectName = RemoteLogUtils.getObjectNameFromLogPath(logPath); |
|
|
|
|