char command[PATH_MAX];
ret = snprintf(command, sizeof(command),
- "/usr/bin/dump_systemstate -d -k -f %s",
+ "/usr/bin/dump_systemstate -d -k -j -f %s",
crash_info.log_path);
if (ret < 0) {
_E("Failed to snprintf for dump_systemstate command");
" -f: write to file (instead of stdout)\n"
" -k: dump kernel messages (only root)\n"
" -d: dump dlog messages\n"
+ " -j: dump journal log messages\n"
);
}
int out_fd = -1;
bool arg_dlog = false;
bool arg_dmesg = false;
+ bool arg_journal = false;
char timestr[80];
time_t cur_time;
struct tm gm_tm;
struct tm loc_tm;
- while ((c = getopt(argc, argv, "hf:kd")) != -1) {
+ while ((c = getopt(argc, argv, "hf:kdj")) != -1) {
switch (c) {
case 'd':
arg_dlog = true;
case 'k':
arg_dmesg = true;
break;
+ case 'j':
+ arg_journal = true;
+ break;
case 'f':
arg_file = optarg;
break;
goto exit_close;
}
+ if (arg_journal) {
+ fprintf_fd(out_fd, "\n==== Journal messages\n");
+ ret = run_command_write_fd("/usr/bin/journalctl -b -n 1024", out_fd);
+ if (ret < 0)
+ goto exit_close;
+ }
+
exit_close:
if (arg_file)
close(out_fd);
script_num = scandir(DUMP_SCRIPTS_DIR, &dir_list, NULL, NULL);
if (script_num < 0) {
- _E("Failed to scandir %s",DUMP_SCRIPTS_DIR);
+ _E("Failed to scandir %s", DUMP_SCRIPTS_DIR);
return -1;
}
/* Dump system states */
ret = snprintf(command, sizeof(command),
- "/usr/bin/dump_systemstate -k -d -f "
+ "/usr/bin/dump_systemstate -k -d -j -f "
"%s/dump_systemstate_%s.log", LOG_DUMP_DIR, timestr);
if (ret < 0) {
_E("Failed to snprintf for command");