Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
05fcffd
fix error trace on node init from stat pub
dnck Mar 27, 2019
466d832
of changes to init node
dnck Mar 29, 2019
358a19f
addd gitignore for local
dnck Mar 29, 2019
06a9cc4
Merge remote-tracking branch 'upstream/dev' into dev
dnck Mar 29, 2019
0df0652
Merge remote-tracking branch 'upstream/dev' into dev
dnck Mar 29, 2019
3c2fcd1
Merge remote-tracking branch 'upstream/dev' into dev
dnck Apr 2, 2019
6fd6b9b
Merge remote-tracking branch 'upstream/dev' into dev
dnck Apr 8, 2019
d91ab5c
new files from upstream
dnck Apr 9, 2019
c3ae874
Merge remote-tracking branch 'upstream/dev' into dev
dnck Apr 24, 2019
6304236
Merge remote-tracking branch 'upstream/dev' into dev
dnck Apr 24, 2019
b04ad75
Merge branch 'dev' of https://github.com/dnck/testnet-1.0 into dev
dnck Apr 24, 2019
30cf46d
bring dev inline with upstream/dev
dnck May 10, 2019
8d96d42
add filters to logback-save
dnck May 10, 2019
5979939
pull in upstream changes
dnck May 15, 2019
67f28f7
sync with upstream and add py scripts for debugging
dnck May 16, 2019
ac49e0b
merge upstream dev into fork dev
dnck May 27, 2019
50dc4a3
clean up imports in node.java
dnck Jun 17, 2019
6285181
Merge remote-tracking branch 'upstream/dev' into dev
dnck Jun 20, 2019
d4c0e83
Merge remote-tracking branch 'upstream/dev' into dev
dnck Jun 25, 2019
b0254ae
update to gitignore
dnck Jun 28, 2019
00a35e3
format and style to match upstream
dnck Jun 28, 2019
f8844f9
format and style to match upstream
dnck Jun 28, 2019
16f449d
Merge remote-tracking branch 'upstream/dev' into dev
dnck Jul 17, 2019
fb16a88
Merge remote-tracking branch 'upstream/dev' into dev
dnck Jul 22, 2019
a1ff913
log output for tip selection
dnck Jul 22, 2019
afcfd5f
Merge remote-tracking branch 'upstream/dev' into dev
dnck Jul 31, 2019
9d08048
Merge remote-tracking branch 'upstream/dev' into dev
dnck Sep 4, 2019
1aba2aa
match style in upstream
dnck Sep 4, 2019
16037d6
match style in upstream
dnck Sep 4, 2019
9b3002e
match style in upstream
dnck Sep 4, 2019
c0bfcc8
even with upstream dev
dnck Sep 4, 2019
001229b
clean up removedb.py
dnck Sep 4, 2019
e6ecec5
save logs refactor
dnck Sep 5, 2019
71f82e3
remove utility python script from commit
dnck Sep 5, 2019
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
33 changes: 18 additions & 15 deletions src/main/java/net/helix/hlx/utils/HelixIOUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

public class HelixIOUtils extends IOUtils {

Expand All @@ -22,21 +23,23 @@ public static void closeQuietly(AutoCloseable... autoCloseables) {
}

public static void saveLogs() {
String date_parsed = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date());
String root_dir = System.getProperty("user.dir");
String slash = System.getProperty("file.separator");
String logback_xml_filepath = root_dir + slash + "src" + slash + "main" + slash + "resources" + slash + "logback-save.xml";
String logs_dir = root_dir + slash + "logs";
String log_filepath = root_dir + slash + "logs" + slash + "LOG__"+date_parsed+"__.log";

System.setProperty("log.name", log_filepath);
System.setProperty("logback.configurationFile", logback_xml_filepath);

File path_to_log_dir = Paths.get(logs_dir).toFile();

String dateParsed = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(new Date());
UUID uuid = UUID.randomUUID();
String uuidString = uuid.toString();
String rootDir = System.getProperty("user.dir");
String fileSeperator = System.getProperty("file.separator");
String logbackXmlFilepath = String.join(
fileSeperator, rootDir, "src", "main", "resources", "logback-save.xml"
);
String logsDir = String.join(fileSeperator, rootDir, "logs");
String logName = "log-" + dateParsed + "-" + uuidString + ".log";
String logFilepath = String.join(fileSeperator, rootDir, "logs", logName);
System.setProperty("log.name", logFilepath);
System.setProperty("logback.configurationFile", logbackXmlFilepath);
File pathToLogDir = Paths.get(logsDir).toFile();
// check whether path to logs exists and logs is a directory.
if (!path_to_log_dir.exists() || !path_to_log_dir.isDirectory()) {
path_to_log_dir.mkdir();
if (!pathToLogDir.exists() || !pathToLogDir.isDirectory()) {
pathToLogDir.mkdir();
}
}
}
}