Skip to content

Commit fe4af5d

Browse files
author
Eric Smalling
committed
log4shell hacking
1 parent 2102d8d commit fe4af5d

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

todolist-goof/todolist-web-struts/pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,17 @@
2424
<version>0.0.1-SNAPSHOT</version>
2525
</dependency>
2626

27+
<dependency>
28+
<groupId>org.apache.logging.log4j</groupId>
29+
<artifactId>log4j-core</artifactId>
30+
<version>2.7</version>
31+
</dependency>
32+
<dependency>
33+
<groupId>org.apache.logging.log4j</groupId>
34+
<artifactId>log4j-api</artifactId>
35+
<version>2.7</version>
36+
</dependency>
37+
2738
<!-- javaee web api -->
2839
<dependency>
2940
<groupId>javax</groupId>

todolist-goof/todolist-web-struts/src/main/java/io/github/benas/todolist/web/action/todo/SearchTodoAction.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,23 @@
3030

3131
import java.util.List;
3232

33+
import org.apache.logging.log4j.LogManager;
34+
import org.apache.logging.log4j.Logger;
35+
3336
/**
3437
* Action class to search todo list by title.
3538
*
3639
* @author Mahmoud Ben Hassine ([email protected])
3740
*/
3841
public class SearchTodoAction extends BaseAction {
42+
private static final Logger logger = LogManager.getLogger(SearchTodoAction.class);
3943

4044
private String title;
4145

4246
List<Todo> todoList;
4347

4448
public String execute() {
49+
logger.info("Searching for: " + title);
4550
todoList = todoService.searchTodoListByTitle(getSessionUser().getId(), title);
4651
return Action.SUCCESS;
4752
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Extra logging related to initialization of Log4j
2+
# Set to debug or trace if log4j initialization is failing
3+
status = warn
4+
# Name of the configuration
5+
name = ConsoleLogConfigDemo
6+
7+
# Console appender configuration
8+
appender.console.type = Console
9+
appender.console.name = consoleLogger
10+
appender.console.layout.type = PatternLayout
11+
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
12+
13+
# Root logger level
14+
rootLogger.level = info
15+
# Root logger referring to console appender
16+
rootLogger.appenderRef.stdout.ref = consoleLogger

0 commit comments

Comments
 (0)