move debug log in tree formation