[pbs-devel] [PATCH proxmox-backup] api: Outsource the logger initialization to the router

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Sep 29 11:49:22 CEST 2023

On Fri, Sep 29, 2023 at 11:35:06AM +0200, Dominik Csapak wrote:
> high level comment:
> is proxmox-router really the right place for this?
> IMHO where we want to log to should be decided by each binary/daemon/utility etc. and
> not in the crate responsible for routing api requests?
> It would at least be better if it would be it's own crate (e.g. proxmox-log ?)
> I just say this because if we want to rework the logging from workers (which
> live in proxmox-rest-server) this could complicate things
> (though i did not spend too much time thinking what the possible issues could be)
> whats your opinion on that @wolfgang, @thomas?

On the one hand `proxmox-router` is used for both the API daemons and by
our schema-based CLI parser, and we already have `cli::init_cli_logger`
in there.
On the other hand, there's no guarantee that all daemons will use this
crate, if they don't need any schema/CLI parsing, but then again this
can still be initialized specially there...

Basically, I don't specifically object to having a common helper for
a "this is how our daemons usually do logging" type of deal, but it may
still make more sense in proxmox-rest-server.

Regardless of where we put it, for our log refactoring, we'd need this
to return a logger instance, rather than actually setting the logger,
because our API daemons will need a *custom* logger to deal with the
workers, which in turn needs access to the logger created *here*.

The custom logger would then definitely go into `proxmox-rest-server`,
so the syslog portion may as well live there, depending on which we'd
consider more "consistent" with the CLI portion being in
`proxmox-router` - the CLI tools definitely won't want to pull in
`proxmox-rest-server`, so moving the cli logger setup there doesn't make

More information about the pbs-devel mailing list