|
@@ -9,6 +9,8 @@ import com.aliyun.openservices.log.common.LogItem;
|
|
|
import com.sxtvs.open.core.auth.HttpContextUtil;
|
|
|
import jakarta.annotation.PostConstruct;
|
|
|
import lombok.SneakyThrows;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.io.PrintWriter;
|
|
@@ -16,17 +18,24 @@ import java.io.StringWriter;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@Component
|
|
|
+@Slf4j
|
|
|
public class AliyunLogger {
|
|
|
private Producer producer;
|
|
|
- private final String logStore = "java-log";
|
|
|
+ private String logStore = "java-log";
|
|
|
private final String project = "k8s-log-c4d23a31b8c6c4ed49e7fc1473dfd0c57";
|
|
|
|
|
|
private final String app = "open";
|
|
|
|
|
|
+ @Value("${sls.enable}")
|
|
|
+ private boolean enable;
|
|
|
+
|
|
|
|
|
|
@PostConstruct
|
|
|
public void init() {
|
|
|
|
|
|
+ if (!enable) {
|
|
|
+ logStore = "java-log-dev";
|
|
|
+ }
|
|
|
ProducerConfig producerConfig = new ProducerConfig();
|
|
|
producerConfig.setBatchSizeThresholdInBytes(3 * 1024 * 1024);
|
|
|
producerConfig.setBatchCountThreshold(40960);
|