
On 4/26/05, Jody Hagins <jody-boost-011304@atdesk.com> wrote:
On Tue, 26 Apr 2005 12:16:03 -0400 Caleb Epstein <caleb.epstein@gmail.com> wrote:
I think John's approach to having multiple log "levels" is to just use a separate log for each one (e.g. you might have logs called trace, debug, warning, info, and fatal). Logs are either enabled or disabled; there is no "level" or above-some-threshold-type checking as with some other common implementations.
Unfortunately, you lose relativity in logs, which is very important in diagnosing failures. Suppose a problem occurs that gets logged to the "fatal" log. Really, to find out all surrounding context, you need to merge all logs. Unless there is a common sequence number or something like that, you have no way of really knowing what sequence of events led to the problem since they are scattered about in a number of logs. You can make good guesses, but in large that handle multiple requests at the same time, it becomes very difficult.
Note that the presence of multiple logs does *not* imply multiple files. You can use a single appender for everything: add_appender ("*", write_to_file ("app.all.txt"));
I'd prefer a common log, which records levels.
I don't see any harm in this, I'm just trying to communicate my impression of John's implementation. Around the time John announced version 1.3 of the Logging lib (2004-10-28), there was some discussion around structured log "records" (e.g. an object that could capture information related to a log message like a severity, timestamp and possibly a thread ID). See http://thread.gmane.org/gmane.comp.lib.boost.devel/112436 for some discussion on this topic, specifically posts from Johan Nilsson, John, and Darryl Green.
I also think the concept of multiple log variables is important in large systems, where different subsystems may have different log levels (e.g, turn on all logging for new subsystems, and only critical logging for other subsystems).
How about something like this? enable_logs ("*"); disable_logs ("*.debug"); enable_logs ("*net.debug"); -- Caleb Epstein caleb dot epstein at gmail dot com