[lxc-devel] [lxc/lxc] c7b170: log: enable per-thread container name prefix

GitHub noreply at github.com
Wed May 23 15:26:46 UTC 2018


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: c7b1705112bec95110d02b26a8016f7d6ed1cef5
      https://github.com/lxc/lxc/commit/c7b1705112bec95110d02b26a8016f7d6ed1cef5
  Author: Christian Brauner <christian.brauner at ubuntu.com>
  Date:   2018-05-20 (Sun, 20 May 2018)

  Changed paths:
    M src/lxc/conf.h
    M src/lxc/log.c
    M src/lxc/lxccontainer.c

  Log Message:
  -----------
  log: enable per-thread container name prefix

When using the LXC API multi-thread and users initialize a log:

struct lxc_log log;
log.name = "my-log";
lxc_log_init(&log);

all threads will have the same "my-log" prefix even though thy might call
lxc_container_new() in separate threads. There is currently no easy way to
handle per-thread container name prefixes.
To handle this carry a reference to the name of the container in struct
lxc_conf and if no log.name was set, use it by default. This way each thread
will get the container it is currently working on as a log-prefix.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
Reported-by: duguhaotian <duguhaotian at gmail.com>


  Commit: cd7cf94be7946dea6d1a312e6b06cec3f68679e1
      https://github.com/lxc/lxc/commit/cd7cf94be7946dea6d1a312e6b06cec3f68679e1
  Author: Stéphane Graber <stgraber at stgraber.org>
  Date:   2018-05-23 (Wed, 23 May 2018)

  Changed paths:
    M src/lxc/conf.h
    M src/lxc/log.c
    M src/lxc/lxccontainer.c

  Log Message:
  -----------
  Merge pull request #2338 from brauner/2018-05-17/multi_threaded_logging

log: enable per-thread container name prefix


Compare: https://github.com/lxc/lxc/compare/12ad9ba7a801...cd7cf94be794
      **NOTE:** This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.


More information about the lxc-devel mailing list