Closed seriyps closed 2 years ago
In general, Yaws logging needs work, as it's never been converted over to logger
. With the recent Yaws 2.1.0 release, the oldest Erlang/OTP release we now support is 21.0, which is when logger
was introduced, so Yaws should now just drop older logging support and convert fully to logger
.
Thanks. I can try to have a look and maybe send some pull-request to migrate to OTP logger.
What degree of backwards-compatibility should we have? May you point me if there is some documentation describing public logging-related APIs which we should not break?
I guess might be nice to keep yaws_logger
behaviour, but that may require a special logger_handler
for "virtual servers" which requested a custom logger_mod
.
Maybe install individual logger handler for each enabled auth_log
and access_log
.
Some docs I found: https://github.com/erlyaws/yaws/blob/866714d3de230ba73ab7455aa9a9d70079429a87/doc/yaws.tex#L2005-L2023
Actually, it seems the better plan would be:
yaws_log
(default implementation of yaws_logger
behaviour) to be a tiny wrapper over logger:add_handler
logger:remove_handler
logger:log
with logger_std_h
with custom formatter.yaws_log_file_h
Yep, that sounds right.
Ok, pushed a bit different implementation from what I planned, see #443. Still, fully backwards-compatible.
Fixed by #445
I noticed that in
yaws_log
it is assumed that there is always a process registered aserror_logger
and this process isgen_event
:https://github.com/erlyaws/yaws/blob/866714d3de230ba73ab7455aa9a9d70079429a87/src/yaws_log.erl#L363-L368
https://github.com/erlyaws/yaws/blob/866714d3de230ba73ab7455aa9a9d70079429a87/src/yaws_log.erl#L398
But with OTP-21 logger one can have just a custom OTP logger handler registered as
error_logger
which would capture all theerror_logger:*_msg
error_logger:*_report
logs without ever starting any processes witherror_logger
name.I think it might make sense to, maybe, add some config that tells Yaws to not try to manage the
error_logger
?