What you are looking for doesn't currently exist in log4net, but it has been entered as a feature to be implemented. See
here for more info.
Another way you could do this is by taking the source of the
AdoNetAppender and
FileAppender and merge them into a custom appender type.
Creating new appenders isn't difficult and the only new code required would be to check to see if the DB connection is available. If not, use the file appender.
For more info on creating appenders, see
this article
Hope this helps