Write cookies and DB log