Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Log4J 2 #106 #108

Merged
merged 1 commit into from
Dec 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,21 @@
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.0</version>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.10.0</version>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.10.0</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/repodriller/RepoDriller.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import java.text.SimpleDateFormat;
import java.util.Calendar;

import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
* This is the entry point for the RepoDriller framework.
Expand All @@ -29,7 +30,7 @@
*/
public class RepoDriller {

private static Logger log = Logger.getLogger(RepoDriller.class);
private static Logger log = LogManager.getLogger(RepoDriller.class);

public static void main(String[] args) {
System.out.println("You should not run me! :/");
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/repodriller/RepoVisitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import org.repodriller.domain.Commit;
import org.repodriller.persistence.PersistenceMechanism;
import org.repodriller.persistence.csv.CSVFileFormatException;
Expand Down Expand Up @@ -59,7 +61,7 @@ public SCMRepositoryClone(SCMRepository repo, int id) {
/* Fixed-size resource pool, of SCMRepository clones. */
private BlockingQueue<SCMRepositoryClone> clonePool;

private static final Logger log = Logger.getLogger(RepoVisitor.class);
private static final Logger log = LogManager.getLogger(RepoVisitor.class);

public RepoVisitor() {
visitors = new LinkedList<CVPM>();
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/org/repodriller/RepositoryMining.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.log4j.Logger;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import org.repodriller.domain.ChangeSet;
import org.repodriller.domain.Commit;
import org.repodriller.filter.commit.CommitFilter;
Expand Down Expand Up @@ -63,7 +66,7 @@
public class RepositoryMining {

private static final String DATE_FORMAT = "dd/MM/yyyy HH:mm:ss";
private static final Logger log = Logger.getLogger(RepositoryMining.class);
private static final Logger log = LogManager.getLogger(RepositoryMining.class);
private static final int THREADS_PER_CORE = 2;

private List<SCMRepository> repos;
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/org/repodriller/filter/range/DailyCommits.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
import java.util.LinkedList;
import java.util.List;

import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import org.repodriller.domain.ChangeSet;
import org.repodriller.scm.SCM;

public class DailyCommits implements CommitRange {

private final long daysInMillis;

private static final Logger log = Logger.getLogger(DailyCommits.class);
private static final Logger log = LogManager.getLogger(DailyCommits.class);

public DailyCommits(int days) {
daysInMillis = 1000L * 60L * 60L * 24L * days;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
import java.util.LinkedList;
import java.util.List;

import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import org.repodriller.domain.ChangeSet;
import org.repodriller.scm.SCM;

public class MonthlyCommits implements CommitRange {

private final long monthsInMillis;

private static final Logger log = Logger.getLogger(MonthlyCommits.class);
private static final Logger log = LogManager.getLogger(MonthlyCommits.class);


public MonthlyCommits(int months) {
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/org/repodriller/persistence/csv/CSVFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
import java.util.stream.Stream;

import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.log4j.Logger;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import org.repodriller.RepoDrillerException;
import org.repodriller.persistence.PersistenceMechanism;

Expand All @@ -40,7 +43,7 @@ public class CSVFile implements PersistenceMechanism {

private boolean isOpen = false;

private static final Logger log = Logger.getLogger(CSVFile.class);
private static final Logger log = LogManager.getLogger(CSVFile.class);

/* Various constructors. */

Expand Down
7 changes: 5 additions & 2 deletions src/main/java/org/repodriller/scm/GitRemoteRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
import java.util.List;

import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.repodriller.RepoDrillerException;
Expand Down Expand Up @@ -41,7 +44,7 @@ public class GitRemoteRepository extends GitRepository {
private Path path; /* TODO GitRepository also has a path member. Make it protected and inherit, or use getter/setter as needed? */
private boolean bareClone = false;

private static Logger log = Logger.getLogger(GitRemoteRepository.class);
private static Logger log = LogManager.getLogger(GitRemoteRepository.class);

/**
* @param uri Where do we clone the repo from?
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/org/repodriller/scm/GitRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
import java.util.stream.Collectors;

import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.ResetCommand.ResetType;
import org.eclipse.jgit.api.errors.GitAPIException;
Expand Down Expand Up @@ -78,7 +81,7 @@ public class GitRepository implements SCM {
private int maxNumberFilesInACommit = -1; /* TODO Expose an API to control this value? Also in SubversionRepository. */
private int maxSizeOfDiff = -1; /* TODO Expose an API to control this value? Also in SubversionRepository. */

private static Logger log = Logger.getLogger(GitRepository.class);
private static Logger log = LogManager.getLogger(GitRepository.class);

/* User-specified. */
private String path = null;
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/org/repodriller/scm/SubversionRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
import java.util.Map.Entry;

import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import org.repodriller.RepoDrillerException;
import org.repodriller.domain.ChangeSet;
import org.repodriller.domain.Commit;
Expand Down Expand Up @@ -50,7 +53,7 @@ public class SubversionRepository implements SCM {
private static final int MAX_SIZE_OF_A_DIFF = 100000;
private static final int DEFAULT_MAX_NUMBER_OF_FILES_IN_A_COMMIT = 50;

private static Logger log = Logger.getLogger(SubversionRepository.class);
private static Logger log = LogManager.getLogger(SubversionRepository.class);
private String path;
private String username;
private String password;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/repodriller/util/SimpleCommandExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import java.util.List;
import java.util.Scanner;

import org.apache.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
* If your analysis needs to work with external tools, a SimpleCommandExecutor gives you a clean way to interact with them.
Expand All @@ -18,11 +19,10 @@
* @author Mauricio Aniche
*/
public class SimpleCommandExecutor {

private List<EnvironmentVar> envVars = null;
private boolean inheritEnv = false;

private static Logger log = Logger.getLogger(SimpleCommandExecutor.class);
private static Logger log = LogManager.getLogger(SimpleCommandExecutor.class);

public SimpleCommandExecutor() {
envVars = new ArrayList<EnvironmentVar>();
Expand Down