Logging and signals handling