Skip to content

Commit

Permalink
Merge pull request #598 from shanwb/master
Browse files Browse the repository at this point in the history
log-agent support jdk20
  • Loading branch information
shanwb authored Aug 29, 2023
2 parents 4035fc5 + 669e1a7 commit 17042e4
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 25 deletions.
5 changes: 5 additions & 0 deletions hera-all/hera-log/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# milog

# log-agent支持jdk20(2023-08-29)
+ 启动参数里注意加上:--enable-preview --add-opens java.base/java.util.regex=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-modules=jdk.incubator.concurrent --add-opens java.base/sun.nio.fs=ALL-UNNAMED


# 支持了外部编译(去除xiaomi全部依赖):2023-04-03

# 代码规范
Expand Down
55 changes: 40 additions & 15 deletions hera-all/hera-log/log-agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,16 @@
<artifactId>log-agent</artifactId>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<maven.compiler.source>20</maven.compiler.source>
<maven.compiler.target>20</maven.compiler.target>
<rocketmq-version>4.9.4</rocketmq-version>
</properties>

<dependencies>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.28</version>
<scope>provided</scope>
</dependency>


<dependency>
<groupId>run.mone</groupId>
<artifactId>docean</artifactId>
<version>1.4-SNAPSHOT</version>
<version>1.4-java20-SNAPSHOT</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -58,6 +49,11 @@
</dependency>


<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>

<dependency>
<groupId>run.mone</groupId>
<artifactId>hera-tspandata</artifactId>
Expand All @@ -77,6 +73,10 @@
</exclusions>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -111,6 +111,16 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>

</dependencies>


Expand All @@ -131,20 +141,21 @@
</resources>

<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<compilerArgs>--enable-preview</compilerArgs>
<compilerArgs>
<arg>--add-modules=jdk.incubator.concurrent</arg>
<arg>--enable-preview</arg>
</compilerArgs>
<compilerVersion>20</compilerVersion>
<source>20</source>
<target>20</target>
</configuration>
</plugin>


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
Expand Down Expand Up @@ -192,6 +203,20 @@
</filters>
</build>
</profile>
<profile>
<id>dev</id>
<properties>
<profiles.active>dev</profiles.active>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<filters>
<filter>src/main/resources/config/dev.properties</filter>
</filters>
</build>
</profile>

</profiles>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public void export(List<LineMessage> messageList) {
.collect(Collectors.toList());

try {
//todo @shanwb 发送失败异常处理
mqProducer.send(messages);
} catch (MQClientException e) {
log.error("rocketmq export MQClientException:{}", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,9 @@ public class RmqOutput extends Output implements Serializable {
public String getEndpoint() {
return clusterInfo;
}

@Override
public String getServiceName() {
return serviceName;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
app_name=milog_agent_dev
nacosAddr=127.0.0.1:80
serviceName=milog_manager_server

log.path=/home/work/log/log-agent
agent.memory.path=/home/work/log/log-agent
agent.channel.locator=json
1 change: 0 additions & 1 deletion hera-all/hera-log/log-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
3 changes: 1 addition & 2 deletions hera-all/hera-log/log-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.7.7</version>
<version>5.8.20</version>
</dependency>

<dependency>
Expand Down
29 changes: 26 additions & 3 deletions hera-all/hera-log/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,29 @@
<artifactId>log4j-web</artifactId>
<version>2.17.0</version>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.1.1-jre</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.28</version>
</dependency>

<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.20</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand All @@ -55,7 +78,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<!-- <version>1.18.4</version>-->
<!-- <scope>provided</scope>-->
</dependency>

Expand Down Expand Up @@ -91,15 +114,15 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.11.0</version>
<configuration>
<source>8</source>
<target>8</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<version>1.18.28</version>
</path>
<path>
<groupId>com.google.auto.service</groupId>
Expand Down
8 changes: 5 additions & 3 deletions jcommon/file/src/main/java/com/xiaomi/mone/file/LogFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;

import javax.xml.bind.DatatypeConverter;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.file.Files;
Expand Down Expand Up @@ -225,8 +224,11 @@ public String md5(String msg) {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(msg.getBytes());
byte[] digest = md.digest();
return DatatypeConverter
.printHexBinary(digest).toUpperCase();
StringBuilder sb = new StringBuilder(2 * digest.length);
for(byte b : digest) {
sb.append(String.format("%02x", b & 0xff));
}
return sb.toString().toUpperCase();
}


Expand Down

0 comments on commit 17042e4

Please sign in to comment.