Skip to content

Commit

Permalink
When printing protocol messages drop printing \n
Browse files Browse the repository at this point in the history
All protocol messages exchanged between the daemons already include an
\n at the end so no need to print an extra one and as such create debug
info that is much harder to parse.
  • Loading branch information
Marco van Wieringen committed May 9, 2015
1 parent 4f36722 commit 093b229
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions src/dird/restore.c
Expand Up @@ -248,7 +248,7 @@ static inline bool do_native_restore_bootstrap(JCR *jcr)
store->SDDport, tls_need, jcr->sd_auth_key);
memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));

Dmsg1(6, "dird>filed: %s\n", fd->msg);
Dmsg1(6, "dird>filed: %s", fd->msg);
if (!response(jcr, fd, OKstore, "Storage", DISPLAY_ERROR)) {
goto bail_out;
}
Expand All @@ -262,7 +262,7 @@ static inline bool do_native_restore_bootstrap(JCR *jcr)
fd->fsend(setauthorizationcmd, jcr->sd_auth_key);
memset(jcr->sd_auth_key, 0, strlen(jcr->sd_auth_key));

Dmsg1(6, "dird>filed: %s\n", fd->msg);
Dmsg1(6, "dird>filed: %s", fd->msg);
if (!response(jcr, fd, OKAuthorization, "Setauthorization", DISPLAY_ERROR)) {
goto bail_out;
}
Expand Down
2 changes: 1 addition & 1 deletion src/dird/scheduler.c
Expand Up @@ -354,7 +354,7 @@ static void find_runs()
nh_woy = tm_woy(next_hour); /* get week of year */
nh_yday = tm.tm_yday; /* get day of year */

Dmsg8(dbglvl, "nh = %x: h=%d m=%d md=%d wd=%d wom=%d woy=%d yday=%d\n\n",
Dmsg8(dbglvl, "nh = %x: h=%d m=%d md=%d wd=%d wom=%d woy=%d yday=%d\n",
next_hour, nh_hour, nh_month, nh_mday, nh_wday, nh_wom, nh_woy, nh_yday);

nh_is_last_week = is_doy_in_last_week(tm.tm_year + 1900 , nh_yday);
Expand Down
12 changes: 6 additions & 6 deletions src/filed/backup.c
Expand Up @@ -226,7 +226,7 @@ static inline bool save_rsrc_and_finder(b_save_ctx &bsctx)

Dmsg1(300, "Saving Finder Info for \"%s\"\n", bsctx.ff_pkt->fname);
sd->fsend("%ld %d 0", bsctx.jcr->JobFiles, STREAM_HFSPLUS_ATTRIBUTES);
Dmsg1(300, "filed>stored:header %s\n", sd->msg);
Dmsg1(300, "filed>stored:header %s", sd->msg);
pm_memcpy(sd->msg, bsctx.ff_pkt->hfsinfo.fndrinfo, 32);
sd->msglen = 32;
if (bsctx.digest) {
Expand Down Expand Up @@ -359,7 +359,7 @@ static inline bool terminate_signing_digest(b_save_ctx &bsctx)
* Send our header
*/
sd->fsend("%ld %ld 0", bsctx.jcr->JobFiles, STREAM_SIGNED_DIGEST);
Dmsg1(300, "filed>stored:header %s\n", sd->msg);
Dmsg1(300, "filed>stored:header %s", sd->msg);

/*
* Encode signature data
Expand Down Expand Up @@ -391,7 +391,7 @@ static inline bool terminate_digest(b_save_ctx &bsctx)
BSOCK *sd = bsctx.jcr->store_bsock;

sd->fsend("%ld %d 0", bsctx.jcr->JobFiles, bsctx.digest_stream);
Dmsg1(300, "filed>stored:header %s\n", sd->msg);
Dmsg1(300, "filed>stored:header %s", sd->msg);

size = CRYPTO_DIGEST_MAX_SIZE;

Expand Down Expand Up @@ -1167,7 +1167,7 @@ static int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt,
}
goto bail_out;
}
Dmsg1(300, ">stored: datahdr %s\n", sd->msg);
Dmsg1(300, ">stored: datahdr %s", sd->msg);

/*
* Make space at beginning of buffer for fileAddr because this
Expand Down Expand Up @@ -1334,7 +1334,7 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream)
}
return false;
}
Dmsg1(300, ">stored: attrhdr %s\n", sd->msg);
Dmsg1(300, ">stored: attrhdr %s", sd->msg);

/**
* Send file attributes to Storage daemon
Expand Down Expand Up @@ -1438,7 +1438,7 @@ bool encode_and_send_attributes(JCR *jcr, FF_PKT *ff_pkt, int &data_stream)
unstrip_path(ff_pkt);
}

Dmsg2(300, ">stored: attr len=%d: %s\n", sd->msglen, sd->msg);
Dmsg2(300, ">stored: attr len=%d: %s", sd->msglen, sd->msg);
if (!status && !jcr->is_job_canceled()) {
Jmsg1(jcr, M_FATAL, 0, _("Network send error to SD. ERR=%s\n"), sd->bstrerror());
}
Expand Down
6 changes: 3 additions & 3 deletions src/stored/askdir.c
Expand Up @@ -109,7 +109,7 @@ bool SD_DCR::dir_update_device(JCR *jcr, DEVICE *dev)
dev->is_tape()?100000:1,
dev->autoselect, 0,
ChangerName.c_str(), MediaType.c_str(), VolumeName.c_str());
Dmsg1(dbglvl, ">dird: %s\n", dir->msg);
Dmsg1(dbglvl, ">dird: %s", dir->msg);
return ok;
}

Expand Down Expand Up @@ -138,7 +138,7 @@ bool SD_DCR::dir_update_changer(JCR *jcr, AUTOCHANGER *changer)
"*", /* ChangerName */
MediaType.c_str(), /* MediaType */
"*"); /* VolName */
Dmsg1(dbglvl, ">dird: %s\n", dir->msg);
Dmsg1(dbglvl, ">dird: %s", dir->msg);
return ok;
}
#endif
Expand Down Expand Up @@ -483,7 +483,7 @@ bool SD_DCR::dir_update_file_attributes(DEV_RECORD *record)
ser_uint32(record->data_len);
ser_bytes(record->data, record->data_len);
dir->msglen = ser_length(dir->msg);
Dmsg1(1800, ">dird %s\n", dir->msg); /* Attributes */
Dmsg1(1800, ">dird %s", dir->msg); /* Attributes */
return dir->send();
}

Expand Down
4 changes: 2 additions & 2 deletions src/stored/fd_cmds.c
Expand Up @@ -244,7 +244,7 @@ void do_fd_commands(JCR *jcr)
if (!found) { /* command not found */
if (!job_canceled(jcr)) {
Jmsg1(jcr, M_FATAL, 0, _("FD command not found: %s\n"), fd->msg);
Dmsg1(110, "<filed: Command not found: %s\n", fd->msg);
Dmsg1(110, "<filed: Command not found: %s", fd->msg);
}
fd->fsend(ferrmsg);
break;
Expand Down Expand Up @@ -427,7 +427,7 @@ static bool read_close_session(JCR *jcr)
* Send final close msg to File daemon
*/
fd->fsend(OK_close, jcr->JobStatus);
Dmsg1(160, ">filed: %s\n", fd->msg);
Dmsg1(160, ">filed: %s", fd->msg);

fd->signal(BNET_EOD); /* send EOD to File daemon */

Expand Down
12 changes: 6 additions & 6 deletions src/stored/job.c
Expand Up @@ -323,7 +323,7 @@ bool nextrun_cmd(JCR *jcr)
*/
return true;
default:
Dmsg1(200, "Nextrun_cmd: %s\n", jcr->dir_bsock->msg);
Dmsg1(200, "Nextrun_cmd: %s", jcr->dir_bsock->msg);
Jmsg2(jcr, M_FATAL, 0, _("Hey!!!! JobId %u Job %s tries to use nextrun cmd while not part of protocol.\n"),
(uint32_t)jcr->JobId, jcr->Job);
return false;
Expand All @@ -341,7 +341,7 @@ bool finish_cmd(JCR *jcr)
*/
switch (jcr->getJobProtocol()) {
case PT_NDMP:
Dmsg1(200, "Finish_cmd: %s\n", jcr->dir_bsock->msg);
Dmsg1(200, "Finish_cmd: %s", jcr->dir_bsock->msg);

jcr->end_time = time(NULL);
dequeue_messages(jcr); /* send any queued messages */
Expand Down Expand Up @@ -370,7 +370,7 @@ bool finish_cmd(JCR *jcr)

return false; /* Continue DIR session ? */
default:
Dmsg1(200, "Finish_cmd: %s\n", jcr->dir_bsock->msg);
Dmsg1(200, "Finish_cmd: %s", jcr->dir_bsock->msg);
Jmsg2(jcr, M_FATAL, 0, _("Hey!!!! JobId %u Job %s tries to use finish cmd while not part of protocol.\n"),
(uint32_t)jcr->JobId, jcr->Job);
return false; /* Continue DIR session ? */
Expand All @@ -396,7 +396,7 @@ bool query_cmd(JCR *jcr)

Dmsg1(100, "Query_cmd: %s", dir->msg);
ok = sscanf(dir->msg, query_device, dev_name.c_str()) == 1;
Dmsg1(100, "<dird: %s\n", dir->msg);
Dmsg1(100, "<dird: %s", dir->msg);
if (ok) {
unbash_spaces(dev_name);
foreach_res(device, R_DEVICE) {
Expand Down Expand Up @@ -436,12 +436,12 @@ bool query_cmd(JCR *jcr)
unbash_spaces(dir->msg);
pm_strcpy(jcr->errmsg, dir->msg);
dir->fsend(NO_device, dev_name.c_str());
Dmsg1(100, ">dird: %s\n", dir->msg);
Dmsg1(100, ">dird: %s", dir->msg);
} else {
unbash_spaces(dir->msg);
pm_strcpy(jcr->errmsg, dir->msg);
dir->fsend(BAD_query, jcr->errmsg);
Dmsg1(100, ">dird: %s\n", dir->msg);
Dmsg1(100, ">dird: %s", dir->msg);
}

return true;
Expand Down
4 changes: 2 additions & 2 deletions src/stored/read.c
Expand Up @@ -132,12 +132,12 @@ static bool record_cb(DCR *dcr, DEV_RECORD *rec)
*/
if (!fd->fsend(rec_header, rec->VolSessionId, rec->VolSessionTime,
rec->FileIndex, rec->Stream, rec->data_len)) {
Pmsg1(000, _(">filed: Error Hdr=%s\n"), fd->msg);
Pmsg1(000, _(">filed: Error Hdr=%s"), fd->msg);
Jmsg1(jcr, M_FATAL, 0, _("Error sending to File daemon. ERR=%s\n"),
fd->bstrerror());
return false;
} else {
Dmsg1(400, ">filed: Hdr=%s\n", fd->msg);
Dmsg1(400, ">filed: Hdr=%s", fd->msg);
}

/*
Expand Down
6 changes: 3 additions & 3 deletions src/stored/sd_stats.c
Expand Up @@ -490,7 +490,7 @@ bool stats_cmd(JCR *jcr)
dev_stat->DevWriteTime, dev_stat->MediaId,
dev_stat->VolCatBytes, dev_stat->VolCatFiles,
dev_stat->VolCatBlocks);
Dmsg1(100, ">dird: %s\n", msg.c_str());
Dmsg1(100, ">dird: %s", msg.c_str());
dir->fsend(msg.c_str());
}

Expand Down Expand Up @@ -520,7 +520,7 @@ bool stats_cmd(JCR *jcr)
pm_strcpy(dev_tmp, dev_stats->DevName);
bash_spaces(dev_tmp);
Mmsg(msg, TapeAlerts, tape_alert->timestamp, dev_tmp.c_str(), tape_alert->flags);
Dmsg1(100, ">dird: %s\n", msg.c_str());
Dmsg1(100, ">dird: %s", msg.c_str());
dir->fsend(msg.c_str());

next_tape_alert = (struct device_tapealert *)dev_stats->tapealerts->next(tape_alert);
Expand Down Expand Up @@ -555,7 +555,7 @@ bool stats_cmd(JCR *jcr)
bash_spaces(dev_tmp);
Mmsg(msg, JobStats, job_stat->timestamp, job_stats->JobId,
job_stat->JobFiles, job_stat->JobBytes, dev_tmp.c_str());
Dmsg1(100, ">dird: %s\n", msg.c_str());
Dmsg1(100, ">dird: %s", msg.c_str());
dir->fsend(msg.c_str());
}

Expand Down

0 comments on commit 093b229

Please sign in to comment.