7max/log4cl — pull request #19 by scymtym (2013-08-30 14:00:58+00:00)
Title: Re-resolve streams of THIS-CONSOLE-APPENDER instances in INIT-HOOK

``this-console-appender`` "resolves" its stream, obtaining an ``fd-stream``, at initialization time. In SBCL, such a ``fd-stream`` becomes invalid after image save/restart. Using such an invalid ``fd-stream`` can lead to "Bad file descriptor" errors:

```
$ sbcl --noinform --no-userinit \
--load ~/.local/share/common-lisp/quicklisp/setup.lisp \
--eval '(ql:quickload :log4cl)' \
--eval '(defun f () (log:info "bla"))' \
--eval '(save-lisp-and-die "bla" :executable t :toplevel (quote f))'
[...]
$ ./bla
[15:22:07] cl-user (f) - bla
ERROR - Caught SB-INT:SIMPLE-STREAM-ERROR
Couldn't write to #:
Bad file descriptor
Removing #
from #
```

and even memory corruption.

This patch extends ``init-hook`` to re-resolve ``this-console-appender`` streams and adds logging of errors to init/save/exit hooks.