Michael DeHaan wrote:
> Plans for logging changes, which are a prereq to further work on
> background tasks:
>
> * Moving forward, we are going to be removing all /print/ calls from
> cobblerd actions, as all actions will be through cobblerd, as a result,
> there will be no printing.
> * We will be replacing all traceback.print_exc() calls with
> utils.log_exc(logger)
> * All subprocess calls will be replaced with a utils.something() call
> that also takes a logger, logs the command executed as a "info" entry
> and then logs the output in the same file.
> * All prints will be replaced, for starters, with logger.info, unless
> it's obvious that they are warning messages (logger.warning) or error
> messages (logger.error).
> * All CobblerExceptions will be logged by logger.error.
> * Each background task gets a log in /var/log/cobbler/tasks/$id.log, if
> there is no task, it will be logged in /var/log/cobbler/cobbler.log
> * Cobblerd.log goes away -- there's no need to seperate local and remote
> logs
> * When new tasks are created, the name of the log file will be mentioned
> in the log -- ditto for tasks completing or failing.
> * The CLI will most likely tail log files (unless requested not too) to
> give the impression of being local.
>
> Hopefully that makes sense. If not, it should be more self evident
> from coming commits. The changes are actually relatively minimal and
> somewhat overdue.
>
> Because of the changes for logging, the local CLI (which now has a
> split-brain problem with cobblerd until it is properly remoted on the
> 2.0 branch as planned) -- may not show output for some
> actions like you would expect.
>
> Given, however, this is /the/ item I'm working on until it's finished,
> so don't dispair for long... If you are using the development branch in
> any sort of "important" capacity, consider the warning
> that we do not intend for it to be useful or stable at this time :)
>
> --Michael
>
> _______________________________________________
> cobbler-devel mailing list
> cobbler-devel(a)lists.fedorahosted.org
>
https://fedorahosted.org/mailman/listinfo/cobbler-devel
>
>
See action_reposync and remote.py in recent git sources for a start at
this -- I went ahead and implemented my own logger class to remove the
question of Python logging
from the equation (it is really not all that useful).
There is much more that has to be done to the other action methods to
get this further along -- basically removing all sub_process calls with
utils.subprocess_call and so forth, and replacing
prints with log calls.
Once we have this done we can start on seeing that there are wrappers
for launching all major slow functions in background, and can then work
on remoting the CLI.
Note: I've added "--quiet" to the yum options. I'm not sure that's
the
best thing to do, as it doesn't give us as good of progress, but I
wasn't a fan of a log full of control characters. It would be nice
if yum output wouldn't dump to the screen like that, though I don't want
to use the API quite yet as we already have enough code to maintain as is.
Apparently yum is actually doing the right thing, and I had my tests
wrong... there are no control charaters in the log, which is great,
because then we don't have to use --quiet.