diff options
author | Jochen Topf <jochen@topf.org> | 2013-01-24 11:32:36 +0100 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2013-01-24 11:32:36 +0100 |
commit | c455ddbcaeed9e8a12947622dcf2c75e584960f2 (patch) | |
tree | 4e54c91924aeea9503846e57f0192d81b689d855 /web | |
parent | c550d039a5a78ddac09503cbd66ed4031e3222e5 (diff) | |
download | taginfo-c455ddbcaeed9e8a12947622dcf2c75e584960f2.tar taginfo-c455ddbcaeed9e8a12947622dcf2c75e584960f2.tar.gz |
Put SQL queries into their own log, add date to log names
Diffstat (limited to 'web')
-rw-r--r-- | web/config.ru | 5 | ||||
-rw-r--r-- | web/lib/sql.rb | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/web/config.ru b/web/config.ru index 57c2f0b..a926fe8 100644 --- a/web/config.ru +++ b/web/config.ru @@ -8,9 +8,12 @@ require './taginfo.rb' set :run, false set :environment, :production -log = File.new("/osm/taginfo/var/log/taginfo.log", "a+") +today = Time.now.strftime('%Y-%m-%d') +log = File.new("/osm/taginfo/var/log/taginfo-#{ today }.log", "a+") $stdout.reopen(log) $stderr.reopen(log) +$queries_log = File.new("/osm/taginfo/var/log/queries-#{ today }.log", "a+") + run Taginfo diff --git a/web/lib/sql.rb b/web/lib/sql.rb index 3b5fe5e..e2dfbbe 100644 --- a/web/lib/sql.rb +++ b/web/lib/sql.rb @@ -58,7 +58,7 @@ module SQL else p = '' end - puts %Q{SQL duration=#{ duration } query="#{ query };"} + p + ($queries_log||$stdout).puts %Q{SQL duration=#{ duration } query="#{ query };"} + p end out |