Logging level (#38)

* Set logging levels in Makefile using -DRAY_COMMON_LOG_LEVEL=level

* Lower level of some LOG_ERROR messages, log the name of the table operation on failure

* Address rest of Robert's comments

* Fix spurious log message
This commit is contained in:
Stephanie Wang
2016-11-15 20:33:29 -08:00
committed by Robert Nishihara
parent 986ed5c9e8
commit 7babe0d22f
14 changed files with 123 additions and 75 deletions
+3 -3
View File
@@ -6,7 +6,7 @@ BUILD = build
all: $(BUILD)/plasma_store $(BUILD)/plasma_manager $(BUILD)/plasma_client.so $(BUILD)/example $(BUILD)/libplasma_client.a
debug: FORCE
debug: CFLAGS += -DRAY_COMMON_DEBUG=1
debug: CFLAGS += -DRAY_COMMON_LOG_LEVEL=0
debug: all
clean:
@@ -34,8 +34,8 @@ $(BUILD)/example: plasma_client.c plasma.h example.c fling.h fling.c common
common: FORCE
cd ../common; make
# Set the request timeout low for testing purposes.
test: CFLAGS += -DRAY_TIMEOUT=50
# Set the request timeout low and logging level at FATAL for testing purposes.
test: CFLAGS += -DRAY_TIMEOUT=50 -DRAY_COMMON_LOG_LEVEL=4
# First, build and run all the unit tests.
test: $(BUILD)/manager_tests FORCE
./build/manager_tests
+3 -2
View File
@@ -61,11 +61,11 @@ int create_buffer(int64_t size) {
return -1;
}
if (unlink(file_name) != 0) {
LOG_ERR("unlink error");
LOG_ERROR("unlink error");
return -1;
}
if (ftruncate(fd, (off_t) size) != 0) {
LOG_ERR("ftruncate error");
LOG_ERROR("ftruncate error");
return -1;
}
return fd;
@@ -78,6 +78,7 @@ void *fake_mmap(size_t size) {
size += sizeof(size_t);
int fd = create_buffer(size);
CHECKM(fd >= 0, "Failed to create buffer during mmap");
void *pointer = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (pointer == MAP_FAILED) {
return pointer;
+4 -7
View File
@@ -415,13 +415,11 @@ bool plasma_manager_is_connected(plasma_connection *conn) {
int plasma_manager_try_connect(const char *ip_addr, int port) {
int fd = socket(PF_INET, SOCK_STREAM, 0);
if (fd < 0) {
LOG_ERR("could not create socket");
return -1;
}
struct hostent *manager = gethostbyname(ip_addr); /* TODO(pcm): cache this */
if (!manager) {
LOG_ERR("plasma manager %s not found", ip_addr);
return -1;
}
@@ -432,10 +430,6 @@ int plasma_manager_try_connect(const char *ip_addr, int port) {
int r = connect(fd, (struct sockaddr *) &addr, sizeof(addr));
if (r < 0) {
LOG_ERR(
"could not establish connection to manager with id %s:%d (may have run "
"out of ports)",
&ip_addr[0], port);
return -1;
}
return fd;
@@ -454,6 +448,9 @@ int plasma_manager_connect(const char *ip_addr, int port) {
/* Sleep for 100 milliseconds. */
usleep(100000);
}
if (fd < 0) {
LOG_WARN("Unable to connect to plasma manager at %s:%d", ip_addr, port);
}
return fd;
}
@@ -489,7 +486,7 @@ void plasma_fetch(plasma_connection *conn,
nbytes = recv(conn->manager_conn, (uint8_t *) &reply, sizeof(reply),
MSG_WAITALL);
if (nbytes < 0) {
LOG_ERR("Error while waiting for manager response in fetch");
LOG_ERROR("Error while waiting for manager response in fetch");
success = 0;
} else if (nbytes == 0) {
success = 0;
+2 -2
View File
@@ -326,7 +326,7 @@ void write_object_chunk(client_connection *conn, plasma_request_buffer *buf) {
if (r != s) {
if (r > 0) {
LOG_ERR("partial write on fd %d", conn->fd);
LOG_ERROR("partial write on fd %d", conn->fd);
} else {
/* TODO(swang): This should not be a fatal error, since connections can
* close at any time. */
@@ -405,7 +405,7 @@ int read_object_chunk(client_connection *conn, plasma_request_buffer *buf) {
r = read(conn->fd, buf->data + conn->cursor, s);
if (r == -1) {
LOG_ERR("read error");
LOG_ERROR("read error");
} else if (r == 0) {
LOG_DEBUG("end of file");
} else {