Fix logging and add metadata logging