connecting log with database