Add log file

And core ref everywhere