Commit f41ebb4b authored by Marc Vef's avatar Marc Vef
Browse files

Merge branch 'jathenst/278-client-logging-add-per-process-log-option' into 'master'

Resolve "Client logging: Add per process log option"

Closes #278

Closes #278

See merge request !179
parents c4d2a5a0 4f16eb71
Loading
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -9,6 +9,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### New

- Support for client-side per process logging, activated
  with `LIBGKFS_LOG_PER_PROCESS` ([!179](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/179)).
- Support mtime with option gkfs::config::metadata::
  use_mtime ([!178](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/178))
- Additional tests to increase code coverage ([!141](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/141)).
- GKFS_ENABLE_UNUSED_FUNCTIONS added to disable code to increase code
  coverage. ([!141](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/141)).
+2 −1
Original line number Diff line number Diff line
@@ -200,7 +200,8 @@ usage: gkfs [-h/--help] [-r/--rootdir <path>] [-m/--mountdir <path>] [-a/--args
The following environment variables can be used to enable logging in the client library: `LIBGKFS_LOG=<module>`
and `LIBGKFS_LOG_OUTPUT=<path/to/file>` to configure the output module and set the path to the log file of the client
library. If not path is specified in `LIBGKFS_LOG_OUTPUT`, the client library will send log messages
to `/tmp/gkfs_client.log`.
to `/tmp/gkfs_client.log`. Use `LIBGKFS_LOG_PER_PROCESS=ON` to write separate logs per client process.
When enabled, the path specified with `LIBGKFS_LOG_OUTPUT=<path/to/dir>` is used as a directory.

The following modules are available:

+3 −2
Original line number Diff line number Diff line
@@ -180,7 +180,8 @@ usage: gkfs [-h/--help] [-r/--rootdir <path>] [-m/--mountdir <path>] [-a/--args
The following environment variables can be used to enable logging in the client library: `LIBGKFS_LOG=<module>`
and `LIBGKFS_LOG_OUTPUT=<path/to/file>` to configure the output module and set the path to the log file of the client
library. If not path is specified in `LIBGKFS_LOG_OUTPUT`, the client library will send log messages
to `/tmp/gkfs_client.log`.
to `/tmp/gkfs_client.log`. Use `LIBGKFS_LOG_PER_PROCESS=ON` to write separate logs per client process.
When enabled, the path specified with `LIBGKFS_LOG_OUTPUT=<path/to/dir>` is used as a directory.

The following modules are available:

+1 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ static constexpr auto LOG_SYSCALL_FILTER = ADD_PREFIX("LOG_SYSCALL_FILTER");
#endif

static constexpr auto LOG_OUTPUT = ADD_PREFIX("LOG_OUTPUT");
static constexpr auto LOG_PER_PROCESS = ADD_PREFIX("LOG_PER_PROCESS");
static constexpr auto LOG_OUTPUT_TRUNC = ADD_PREFIX("LOG_OUTPUT_TRUNC");
static constexpr auto CWD = ADD_PREFIX("CWD");
static constexpr auto HOSTS_FILE = ADD_PREFIX("HOSTS_FILE");
+5 −3
Original line number Diff line number Diff line
@@ -273,7 +273,8 @@ protected:

struct logger {

    logger(const std::string& opts, const std::string& path, bool trunc
    logger(const std::string& opts, const std::string& path,
           bool log_per_process, bool trunc
#ifdef GKFS_DEBUG_BUILD
           ,
           const std::string& filter, int verbosity
@@ -293,7 +294,7 @@ struct logger {

        static_buffer buffer;
        detail::format_timestamp_to(buffer, timezone_);
        fmt::format_to(buffer, "[{}] [{}] ", ::syscall_no_intercept(SYS_gettid),
        fmt::format_to(buffer, "[{}] [{}] ", log_process_id_,
                       lookup_level_name(level));

        if(!!(level & log::debug)) {
@@ -336,7 +337,7 @@ struct logger {

        static_buffer prefix;
        detail::format_timestamp_to(prefix);
        fmt::format_to(prefix, "[{}] [{}] ", ::syscall_no_intercept(SYS_gettid),
        fmt::format_to(prefix, "[{}] [{}] ", log_process_id_,
                       lookup_level_name(level));

        char buffer[max_buffer_size];
@@ -402,6 +403,7 @@ struct logger {
    }

    int log_fd_;
    int log_process_id_;
    log_level log_mask_;

#ifdef GKFS_DEBUG_BUILD
Loading