803fb7
From c546fffcff0d2e3522738aac30391d5996bdf4a6 Mon Sep 17 00:00:00 2001
803fb7
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
803fb7
Date: Thu, 12 Mar 2015 21:29:28 -0400
803fb7
Subject: [PATCH] journal-remote: downgrade routine messages to debug
803fb7
803fb7
https://bugs.freedesktop.org/show_bug.cgi?id=89486
803fb7
(cherry picked from commit 0e72da6fe8671d49b4d458519f5ac7600fd04f03)
803fb7
---
803fb7
 src/journal-remote/journal-remote-parse.c |  2 +-
803fb7
 src/journal-remote/journal-remote-write.c |  2 +-
de8967
 src/journal-remote/journal-remote.c       | 36 +++++++++++------------
de8967
 src/journal-remote/microhttpd-util.c      |  4 +--
803fb7
 4 files changed, 22 insertions(+), 22 deletions(-)
803fb7
803fb7
diff --git a/src/journal-remote/journal-remote-parse.c b/src/journal-remote/journal-remote-parse.c
803fb7
index afded7e38..6c096de03 100644
803fb7
--- a/src/journal-remote/journal-remote-parse.c
803fb7
+++ b/src/journal-remote/journal-remote-parse.c
803fb7
@@ -443,7 +443,7 @@ int process_source(RemoteSource *source, bool compress, bool seal) {
803fb7
                 return r;
803fb7
 
803fb7
         /* We have a full event */
803fb7
-        log_trace("Received a full event from source@%p fd:%d (%s)",
803fb7
+        log_trace("Received full event from source@%p fd:%d (%s)",
803fb7
                   source, source->fd, source->name);
803fb7
 
803fb7
         if (!source->iovw.count) {
803fb7
diff --git a/src/journal-remote/journal-remote-write.c b/src/journal-remote/journal-remote-write.c
803fb7
index df3004939..99820fa7b 100644
803fb7
--- a/src/journal-remote/journal-remote-write.c
803fb7
+++ b/src/journal-remote/journal-remote-write.c
803fb7
@@ -156,7 +156,7 @@ int writer_write(Writer *w,
803fb7
         if (r < 0)
803fb7
                 return r;
803fb7
         else
803fb7
-                log_info("%s: Successfully rotated journal", w->journal->path);
803fb7
+                log_debug("%s: Successfully rotated journal", w->journal->path);
803fb7
 
803fb7
         log_debug("Retrying write.");
803fb7
         r = journal_file_append_entry(w->journal, ts, iovw->iovec, iovw->count,
803fb7
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c
803fb7
index 8f32a9a98..d1486e7cd 100644
803fb7
--- a/src/journal-remote/journal-remote.c
803fb7
+++ b/src/journal-remote/journal-remote.c
803fb7
@@ -207,7 +207,7 @@ static int open_output(Writer *w, const char* host) {
803fb7
                 log_error_errno(r, "Failed to open output journal %s: %m",
803fb7
                                 output);
803fb7
         else
803fb7
-                log_info("Opened output file %s", w->journal->path);
803fb7
+                log_debug("Opened output file %s", w->journal->path);
803fb7
         return r;
803fb7
 }
803fb7
 
803fb7
@@ -747,7 +747,7 @@ static int setup_microhttpd_socket(RemoteServer *s,
803fb7
                                    const char *trust) {
803fb7
         int fd;
803fb7
 
803fb7
-        fd = make_socket_fd(LOG_INFO, address, SOCK_STREAM | SOCK_CLOEXEC);
803fb7
+        fd = make_socket_fd(LOG_DEBUG, address, SOCK_STREAM | SOCK_CLOEXEC);
803fb7
         if (fd < 0)
803fb7
                 return fd;
803fb7
 
803fb7
@@ -844,7 +844,7 @@ static int remoteserver_init(RemoteServer *s,
803fb7
         if (n < 0)
803fb7
                 return log_error_errno(n, "Failed to read listening file descriptors from environment: %m");
803fb7
         else
803fb7
-                log_info("Received %d descriptors", n);
803fb7
+                log_debug("Received %d descriptors", n);
803fb7
 
803fb7
         if (MAX(http_socket, https_socket) >= SD_LISTEN_FDS_START + n) {
803fb7
                 log_error("Received fewer sockets than expected");
803fb7
@@ -853,7 +853,7 @@ static int remoteserver_init(RemoteServer *s,
803fb7
 
803fb7
         for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + n; fd++) {
803fb7
                 if (sd_is_socket(fd, AF_UNSPEC, 0, true)) {
803fb7
-                        log_info("Received a listening socket (fd:%d)", fd);
803fb7
+                        log_debug("Received a listening socket (fd:%d)", fd);
803fb7
 
803fb7
                         if (fd == http_socket)
803fb7
                                 r = setup_microhttpd_server(s, fd, NULL, NULL, NULL);
803fb7
@@ -868,7 +868,7 @@ static int remoteserver_init(RemoteServer *s,
803fb7
                         if (r < 0)
803fb7
                                 return log_error_errno(r, "Failed to retrieve remote name: %m");
803fb7
 
803fb7
-                        log_info("Received a connection socket (fd:%d) from %s", fd, hostname);
803fb7
+                        log_debug("Received a connection socket (fd:%d) from %s", fd, hostname);
803fb7
 
803fb7
                         r = add_source(s, fd, hostname, true);
803fb7
                 } else {
803fb7
@@ -908,7 +908,7 @@ static int remoteserver_init(RemoteServer *s,
803fb7
         }
803fb7
 
803fb7
         if (arg_listen_raw) {
803fb7
-                log_info("Listening on a socket...");
803fb7
+                log_debug("Listening on a socket...");
803fb7
                 r = setup_raw_socket(s, arg_listen_raw);
803fb7
                 if (r < 0)
803fb7
                         return r;
803fb7
@@ -930,12 +930,12 @@ static int remoteserver_init(RemoteServer *s,
803fb7
                 const char *output_name;
803fb7
 
803fb7
                 if (streq(*file, "-")) {
803fb7
-                        log_info("Using standard input as source.");
803fb7
+                        log_debug("Using standard input as source.");
803fb7
 
803fb7
                         fd = STDIN_FILENO;
803fb7
                         output_name = "stdin";
803fb7
                 } else {
803fb7
-                        log_info("Reading file %s...", *file);
803fb7
+                        log_debug("Reading file %s...", *file);
803fb7
 
803fb7
                         fd = open(*file, O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NONBLOCK);
803fb7
                         if (fd < 0)
803fb7
@@ -1014,22 +1014,22 @@ static int dispatch_raw_source_event(sd_event_source *event,
803fb7
         if (source->state == STATE_EOF) {
803fb7
                 size_t remaining;
803fb7
 
803fb7
-                log_info("EOF reached with source fd:%d (%s)",
803fb7
-                         source->fd, source->name);
803fb7
+                log_debug("EOF reached with source fd:%d (%s)",
803fb7
+                          source->fd, source->name);
803fb7
 
803fb7
                 remaining = source_non_empty(source);
803fb7
                 if (remaining > 0)
803fb7
-                        log_warning("Premature EOF. %zu bytes lost.", remaining);
803fb7
+                        log_notice("Premature EOF. %zu bytes lost.", remaining);
803fb7
                 remove_source(s, source->fd);
803fb7
-                log_info("%zu active sources remaining", s->active);
803fb7
+                log_debug("%zu active sources remaining", s->active);
803fb7
                 return 0;
803fb7
         } else if (r == -E2BIG) {
803fb7
-                log_error("Entry too big, skipped");
803fb7
+                log_notice_errno(E2BIG, "Entry too big, skipped");
803fb7
                 return 1;
803fb7
         } else if (r == -EAGAIN) {
803fb7
                 return 0;
803fb7
         } else if (r < 0) {
803fb7
-                log_info_errno(r, "Closing connection: %m");
803fb7
+                log_debug_errno(r, "Closing connection: %m");
803fb7
                 remove_source(server, fd);
803fb7
                 return 0;
803fb7
         } else
803fb7
@@ -1071,10 +1071,10 @@ static int accept_connection(const char* type, int fd,
803fb7
                         return r;
803fb7
                 }
803fb7
 
803fb7
-                log_info("Accepted %s %s connection from %s",
803fb7
-                         type,
803fb7
-                         socket_address_family(addr) == AF_INET ? "IP" : "IPv6",
803fb7
-                         a);
803fb7
+                log_debug("Accepted %s %s connection from %s",
803fb7
+                          type,
803fb7
+                          socket_address_family(addr) == AF_INET ? "IP" : "IPv6",
803fb7
+                          a);
803fb7
 
803fb7
                 *hostname = b;
803fb7
 
803fb7
diff --git a/src/journal-remote/microhttpd-util.c b/src/journal-remote/microhttpd-util.c
803fb7
index a95fff18f..b45c38d68 100644
803fb7
--- a/src/journal-remote/microhttpd-util.c
803fb7
+++ b/src/journal-remote/microhttpd-util.c
803fb7
@@ -178,7 +178,7 @@ static int verify_cert_authorized(gnutls_session_t session) {
803fb7
         if (r < 0)
803fb7
                 return log_error_errno(r, "gnutls_certificate_verification_status_print failed: %m");
803fb7
 
803fb7
-        log_info("Certificate status: %s", out.data);
803fb7
+        log_debug("Certificate status: %s", out.data);
803fb7
         gnutls_free(out.data);
803fb7
 
803fb7
         return status == 0 ? 0 : -EPERM;
803fb7
@@ -280,7 +280,7 @@ int check_permissions(struct MHD_Connection *connection, int *code, char **hostn
803fb7
                 return -EPERM;
803fb7
         }
803fb7
 
803fb7
-        log_info("Connection from %s", buf);
803fb7
+        log_debug("Connection from %s", buf);
803fb7
 
803fb7
         if (hostname) {
803fb7
                 *hostname = buf;