]> git.ipfire.org Git - thirdparty/lxc.git/commit
log: enable per-thread container name prefix 2338/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 20 May 2018 12:05:51 +0000 (14:05 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 20 May 2018 12:05:51 +0000 (14:05 +0200)
commitc7b1705112bec95110d02b26a8016f7d6ed1cef5
tree185667f54ed6032e493860e1ce326422c779f04c
parentb5ead53aaff18cff3fa60f0d66ff6734be779c6a
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@ubuntu.com>
Reported-by: duguhaotian <duguhaotian@gmail.com>
src/lxc/conf.h
src/lxc/log.c
src/lxc/lxccontainer.c