Support defined log output
Change-Id: Ibfa5b152c2b7db21c28c2dfe1c247ab5bd47d12e
diff --git a/Changes b/Changes
index 59e50a9..a9f0ce0 100755
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+0.51 2023-05-16
+ - Support defined log file in configuration. (diewald)
+
0.50 2023-05-08
- Improvement of NKJP-annotation helper. (diewald)
- Add redirect-uri to client view. (diewald)
diff --git a/kalamar.conf b/kalamar.conf
index 1b3e779..fe7f327 100644
--- a/kalamar.conf
+++ b/kalamar.conf
@@ -39,6 +39,9 @@
## Backend API version
# api_version => '1.0',
+ ## Log file
+ # log_file => 'logs/kalamar.log',
+
## If the application is run behind a proxy, ignore the forwarded host
# proxy_host => 0,
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index d6623d5..5de4c22 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -8,7 +8,7 @@
use List::Util qw!none uniq!;
# Minor version - may be patched from package.json
-our $VERSION = '0.50';
+our $VERSION = '0.51';
# Supported version of Backend API
our $API_VERSION = '1.0';
@@ -102,6 +102,15 @@
$conf = $self->config('Kalamar');
};
+ # Set log file. All precedng logs where send to stderr
+ if ($conf->{log_file}) {
+ Mojo::File->new(Mojo::File->new($conf->{log_file})->dirname)->make_path;
+ $self->log(Mojo::Log->new(
+ path => $conf->{log_file},
+ ));
+ };
+
+
# Check for API endpoint and set the endpoint accordingly
if ($conf->{api}) {