diff --git a/src/calibre/ebooks/html/input.py b/src/calibre/ebooks/html/input.py
index 51c74228b7..d57bfddd3e 100644
--- a/src/calibre/ebooks/html/input.py
+++ b/src/calibre/ebooks/html/input.py
@@ -491,6 +491,9 @@ class HTMLInput(InputFormatPlugin):
return (None, raw)
def preprocess_html(self, html):
+ if not hasattr(self, 'log'):
+ from calibre.utils.logging import default_log
+ self.log = default_log
self.log("********* Preprocessing HTML *********")
# Detect Chapters to match the xpath in the GUI
chapdetect = re.compile(r'(?=?(br|p|span))(?(br|p|span)[^>]*>)?\s*(?P(<(i|b)><(i|b)>|<(i|b)>)?(.?Chapter|Epilogue|Prologue|Book|Part|Dedication)\s*([\d\w-]+(\s\w+)?)?((i|b)>(i|b)>|(i|b)>)?)(?(p|br|span)[^>]*>)', re.IGNORECASE)