diff options
author | Jochen Topf <jochen@topf.org> | 2014-02-16 11:28:43 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2014-02-16 11:28:43 +0100 |
commit | f5dfcb9e7710a763a501a8ae4bfa3b225807c0b2 (patch) | |
tree | 0f683bd5bfcf46f222c8daf7618ed099100a79ba | |
parent | e87011e6133359e61c415feebc7466fbb05531ce (diff) | |
download | taginfo-f5dfcb9e7710a763a501a8ae4bfa3b225807c0b2.tar taginfo-f5dfcb9e7710a763a501a8ae4bfa3b225807c0b2.tar.gz |
Make taginfo log directory configurable.
-rw-r--r-- | taginfo-config-example.json | 2 | ||||
-rw-r--r-- | web/config.ru | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/taginfo-config-example.json b/taginfo-config-example.json index 0fcba46..371f02b 100644 --- a/taginfo-config-example.json +++ b/taginfo-config-example.json @@ -73,6 +73,8 @@ } }, "logging": { + // directory for log files + "directory": "/osm/taginfo/var/log", // SQL queries longer than this many seconds are logged "min_duration": 0.01 }, diff --git a/web/config.ru b/web/config.ru index 77fe2da..ee31f15 100644 --- a/web/config.ru +++ b/web/config.ru @@ -4,19 +4,27 @@ require 'sinatra' require './taginfo.rb' +require 'json' +require 'lib/config.rb' + +TaginfoConfig.read + +LOGDIR=TaginfoConfig.get('logging.directory', '/osm/taginfo/var/log'); set :run, false set :environment, :production today = Time.now.strftime('%Y-%m-%d') -log = File.new("/osm/taginfo/var/log/taginfo-#{ today }.log", "a") +log = File.new("#{LOGDIR}/taginfo-#{ today }.log", "a") log.sync = true # https://github.com/joto/taginfo/issues/34 #$stdout.reopen(log) $stderr.reopen(log) -$queries_log = File.new("/osm/taginfo/var/log/queries-#{ today }.log", "a") +$stderr.puts "Taginfo started #{Time.now}" + +$queries_log = File.new("#{LOGDIR}/queries-#{ today }.log", "a") $queries_log.sync = true run Taginfo |