-
Notifications
You must be signed in to change notification settings - Fork 274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I simply can't make Dancer2 write to a log file in a certain directory #1585
Comments
Hello @JJ I'm sorry you are struggling. Note that by default the Dancer2 If you're using the file logging engine, a directory Also note that you may be overriding your Also, note that the options for the logger go in the So you need this in either your
Note that it's best practise to configure your logger per environment (ie in the respective file) because you usually will want different logging outputs. Hope this helps! |
Thanks a lot for your answer, but can you indicate what's wrong above? Is there anything I'm not doing right? As you see, I want to log using JSON; the configuration you have inserted does not seem to cover that. |
Hi @JJ What's wrong with what you showed
How to configure your logger I still think that you originally became confused because you had an You should be able to configure your logger with directory and file name using the Put this in
Logging JSON I recommend that you look into my modules Dancer2::Logger::LogAny (which replaces the default logger with After installing the packages your config would look something like:
And your log would contain lines like:
You can see this configuration in use in a production app in the repo for ContactMyReps.com if you are interested. Hope this helps! |
I finally deleted the
config.yml
because reasons #1584. So I try and set everything by hand:The main file is as in #1583, there's an additional config that sets values. Those mostly seem to work, so I don't think they are relevant (they only set log_dir). But this does not. The problem is not only that they don't work, is that they fail silently. It's quite clear that
set
can be used to set arbitrary key/value combination, so anything goes. But I'd like to know what I can do to set those things, and what combination of settings are needed to log elsewhere. The way it's set now, it simply does not log anywhere.The text was updated successfully, but these errors were encountered: