Replace printing to stderr with logging warning.