write to document and log to console