mojolicious / mojo

:sparkles: Mojolicious - Perl real-time web framework
https://mojolicious.org
Artistic License 2.0
2.66k stars 576 forks source link

the default log file deprecation notice is too eager #1621

Closed dakkar closed 3 years ago

dakkar commented 3 years ago

Steps to reproduce the behavior

mkdir log
MOJO_HOME=. perl -MMojolicious -E 'Mojolicious->new->log->path("/tmp/foo")'

Expected behavior

Nothing should happen, I'm setting a custom logfile.

Actual behavior

Logging to "log/development.log" is DEPRECATED at -e line 1.

why is it a problem

It's warning about a thing I'm not doing: I'm explicitly setting a different path, in my first use of the log object. It took me a while to figure out why my application had started warning me to stop doing something I never did!

The mere existence of a $MOJO_HOME/log directory triggers the warning, before any logging takes place.

Maybe delay the warning until the log object has to write?

kraih commented 3 years ago

I don't think we need to over-engineer that deprecation warning though. This seems like a fairly minor inconvenience for an uncommon scenario.

kraih commented 3 years ago

The 9.0 release is also almost ready. I think we can close this issue.