[Tile-serving] [openstreetmap/osm2pgsql] Improved logging output with timestamps, level settings and more (#1326)
Jochen Topf
notifications at github.com
Tue Nov 17 10:28:19 UTC 2020
This improves the logging output in several ways:
* New logging functions log_debug/info/warn/error(). Almost all
output now uses one of these functions.
* Log messages start with timestamp.
* Log messages of level warn/error are printed in red when
logging to console.
* New command line option: --log-level to set log level. Default
is "info". The option -v, --verbose does the same as
--log-level=debug.
* New option --log-progress=true/false/auto. The default is `auto`
which enables progress logging on the console and disables it
when stderr has been redirected to a file.
* Extra functions to log SQL commands/SQL COPY data. These can
be activated by command line options --log-sql and --log-sql-data,
respectively, instead of the compile time setting. Output is
printed in blue when logging to console.
Most log messages are in level "info" at the moment, so they are shown
as before with the default settings. Many of these probably don't need
to be shown in normal operation and can be downgraded to "debug". I'll
leave this for a later commit.
There are several places in the code where the output is updated on the
screen while some longer process is running:
* The code displaying regular updates of a counter in the expire code
has been removed. Writing out the expire data doesn't take that long,
so it isn't important to have this. Instead a log message is now
generated.
* The output of the objects being processed and the pending ways and
relations output is now en/disabled by the `--log-progress` option.
Otherwise it has not been touched. I'll leave cleaning that up
for a later time.
Some error reporting code has also been changed. Usually errors should
be reported by throwing an exception that is then caught in the main()
function and written out. The exception should contain the whole
error message, sometimes additional logging lines are created before
throwing the error. There is probably some more cleanup needed here.
This introduces a new global object "the_logger". Otherwise we'd have to
add the logger as parameter to a lot of functions!
Fixes #202
Fixes #1246
Fixes #591
You can view, comment on, or merge this pull request online at:
https://github.com/openstreetmap/osm2pgsql/pull/1326
-- Commit Summary --
* Improved logging output with timestamps, level settings and more
-- File Changes --
M docs/osm2pgsql.1 (17)
M docs/osm2pgsql.md (20)
M src/CMakeLists.txt (1)
M src/db-check.cpp (4)
M src/db-copy.cpp (3)
M src/expire-tiles.cpp (22)
M src/expire-tiles.hpp (5)
M src/flex-table.cpp (27)
M src/gazetteer-style.cpp (3)
M src/geom-transform.cpp (8)
M src/input-handler.cpp (10)
A src/logging.cpp (9)
A src/logging.hpp (128)
M src/middle-pgsql.cpp (16)
M src/node-persistent-cache.cpp (11)
M src/node-ram-cache.cpp (32)
M src/options.cpp (101)
M src/options.hpp (1)
M src/osm2pgsql.cpp (19)
M src/osmdata.cpp (31)
M src/output-flex.cpp (33)
M src/output-pgsql.cpp (5)
M src/pgsql.cpp (71)
M src/progress-display.cpp (30)
M src/table.cpp (32)
M src/taginfo.cpp (4)
M src/tagtransform.cpp (9)
-- Patch Links --
https://github.com/openstreetmap/osm2pgsql/pull/1326.patch
https://github.com/openstreetmap/osm2pgsql/pull/1326.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/1326
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20201117/98d418a1/attachment-0001.htm>
More information about the Tile-serving
mailing list