]> git.openstreetmap.org Git - nominatim.git/commitdiff
allow relative paths for log files
authorSarah Hoffmann <lonvia@denofr.de>
Mon, 25 Oct 2021 08:13:11 +0000 (10:13 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Mon, 25 Oct 2021 08:26:05 +0000 (10:26 +0200)
docs/customize/Settings.md
nominatim/tools/refresh.py

index b056a78bf2cc66256e97f3455b5c03eeb6ddade7..428ef11cbc05271a8741f222024c6b9c0d03749c 100644 (file)
@@ -634,7 +634,11 @@ Can be used as the same time as NOMINATIM_LOG_FILE.
 | **After Changes:** | run `nominatim refresh --website` |
 
 Enable logging of requests into a file with this setting by setting the log
-file where to log to. The entries in the log file have the following format:
+file where to log to. A relative file name is assumed to be relative to
+the project directory.
+
+
+The entries in the log file have the following format:
 
     <request time> <execution time in s> <number of results> <type> "<query string>"
 
index a6fe3d19ad808b5101e0f4ce702a75d9b8d8a2a0..0a72b02bee9bf0fbc76cdea29bfed08add7fdf7c 100644 (file)
@@ -3,6 +3,7 @@ Functions for bringing auxiliary data in the database up-to-date.
 """
 import logging
 from textwrap import dedent
+from pathlib import Path
 
 from psycopg2 import sql as pysql
 
@@ -94,7 +95,7 @@ PHP_CONST_DEFS = (
     ('Database_DSN', 'DATABASE_DSN', str),
     ('Default_Language', 'DEFAULT_LANGUAGE', str),
     ('Log_DB', 'LOG_DB', bool),
-    ('Log_File', 'LOG_FILE', str),
+    ('Log_File', 'LOG_FILE', Path),
     ('NoAccessControl', 'CORS_NOACCESSCONTROL', bool),
     ('Places_Max_ID_count', 'LOOKUP_MAX_COUNT', int),
     ('PolygonOutput_MaximumTypes', 'POLYGON_OUTPUT_MAX_TYPES', int),
@@ -162,7 +163,12 @@ def _quote_php_variable(var_type, config, conf_name):
     if not getattr(config, conf_name):
         return 'false'
 
-    quoted = getattr(config, conf_name).replace("'", "\\'")
+    if var_type == Path:
+        value = str(config.get_path(conf_name))
+    else:
+        value = getattr(config, conf_name)
+
+    quoted = value.replace("'", "\\'")
     return f"'{quoted}'"