|
|
@ -44,28 +44,23 @@ public class OssRemoteLogHandler implements RemoteLogHandler, Closeable { |
|
|
|
private static OssRemoteLogHandler instance; |
|
|
|
private static OssRemoteLogHandler instance; |
|
|
|
|
|
|
|
|
|
|
|
private OssRemoteLogHandler() { |
|
|
|
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() { |
|
|
|
public static synchronized OssRemoteLogHandler getInstance() { |
|
|
|
if (instance == null) { |
|
|
|
if (instance == null) { |
|
|
|
instance = new OssRemoteLogHandler(); |
|
|
|
instance = new OssRemoteLogHandler(); |
|
|
|
instance.init(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return instance; |
|
|
|
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 |
|
|
|
@Override |
|
|
|
public void sendRemoteLog(String logPath) { |
|
|
|
public void sendRemoteLog(String logPath) { |
|
|
|
String objectName = RemoteLogUtils.getObjectNameFromLogPath(logPath); |
|
|
|
String objectName = RemoteLogUtils.getObjectNameFromLogPath(logPath); |
|
|
|