Bug 14746 - Set up logging and configuration file reading for Mojolicious
Summary: Set up logging and configuration file reading for Mojolicious
Status: Patch doesn't apply
Alias: None
Product: Koha
Classification: Unclassified
Component: Web services (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Olli-Antti Kivilahti
QA Contact: Testopia
URL:
Keywords:
Depends on: 13799
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-27 16:57 UTC by Julian Maurice
Modified: 2023-08-26 19:34 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Large patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 14746: Set up logging and configuration file reading for Mojolicious (5.22 KB, patch)
2015-08-27 17:00 UTC, Julian Maurice
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Maurice 2015-08-27 16:57:52 UTC
Use environmental values to control some aspects of Mojolicious:
This way we can have different settings for different servers running Mojolicious.
Comment 1 Julian Maurice 2015-08-27 17:00:13 UTC
Created attachment 42039 [details] [review]
Bug 14746: Set up logging and configuration file reading for Mojolicious

Use environmental values to control some aspects of Mojolicious:
This way we can have different settings for different servers running
Mojolicious.

%%%% Configuration file %%%%

$ENV{MOJO_CONFIG} should be set in the system service (init) starting
Mojolicious, eg:
export MOJO_CONFIG=/home/koha/kohaclone/api/v1/hypnotoad.conf

This configuration file read by the Mojolicious::Plugin::Config
http://mojolicio.us/perldoc/Mojolicious/Plugin/Config

%%%%% Logging %%%%%

>NOTE!!
>There is a "feature" in Mojo::Server disabling STDOUT and STDERR,
>because such errors are not-suited-for-prod~
>This modification in Mojo::Server disables this and preserves the STD*
>handles for forked server threads
>in Mojo::Server::daemonize(), comment out the following lines
>
># Close filehandles
>#  open STDOUT, '>/dev/null';
>#  open STDERR, '>&STDOUT';

Log to a filename configured in an environemnt variable
$ENV{MOJO_LOGFILE} using loglevel $ENV{MOJO_LOGLEVEL}.
Defaults to '/tmp/koha-api.log' and loglevel of 'error'
Examples:
export MOJO_LOGFILE=/home/koha/koha-dev/var/log/kohaapi.mojo.log
export MOJO_LOGLEVEL=debug

Logging is done by Mojo::Log
http://www.mojolicio.us/perldoc/Mojo/Log
Comment 2 Zeno Tajoli 2015-09-01 08:21:00 UTC
Patch complexity is 'Large' because this change has many architectural connections
Comment 3 Katrin Fischer 2017-10-08 09:24:33 UTC
Patch currently has a conflict in a file, but should not be hard to resolve. 
How can this be tested?

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 14746: Set up logging and configuration file reading for Mojolicious
Using index info to reconstruct a base tree...
M	Koha/REST/V1.pm
Falling back to patching base and 3-way merge...
Auto-merging Koha/REST/V1.pm
CONFLICT (content): Merge conflict in Koha/REST/V1.pm
error: Failed to merge in the changes.
Patch failed at 0001 Bug 14746: Set up logging and configuration file reading for Mojolicious
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem run "git bz apply --continue".
If you would prefer to skip this patch, instead run "git bz apply --skip".
To restore the original branch and stop patching run "git bz apply --abort".
Patch left in /tmp/Bug-14746-Set-up-logging-and-configuration-file-re-pH4w1p.patch
Comment 4 Katrin Fischer 2023-08-26 19:34:57 UTC
Are there plans to continue with this one?