[OSM-dev] Osm2pgsql outputs
Martijn van Oosterhout
kleptog at gmail.com
Mon Feb 14 21:29:21 GMT 2011
On 13 February 2011 23:46, Jon Burgess <jburgess777 at gmail.com> wrote:
> On Sun, 2011-02-13 at 23:22 +0100, Rodolphe Quiedeville wrote:
>> Is there a reason for logging all actions in osm2pgsql to stderr ? What
>> do you think about splitting outputs and print progress information to
>> stdout ?
> A long time ago I think osm2pgsql wrote the SQL to stdout instead of
> talking directly to the database. I don't see any reason why the
> progress output should not be moved to stdout instead.
One issue is that stdout is usually buffered, whereas stderr is not.
Hence the output where it keeps overwriting itself is usually done on
stderr since it only makes sense on a terminal and not as input to
Arguably the program should check if the output is a terminal and if
not suppress the progress output.
>> I use osm2pgsql as subprocess of python script and look at errors, by
>> now it's not easy to split normal progression from errors.
>> I can do the modification in code, but I prefer to see that point with
>> other dev before doing anything.
If this is the goal I'd suggest another approach entirely, namely to
add an option to suppress the progress output (a sort of quiet option)
or an option to output in a program friendly way, say everything on a
new line and prefix with the message type. A bit more work but may
make a lot more people more happy.
Have a nice day,
Martijn van Oosterhout <kleptog at gmail.com> http://svana.org/kleptog/
More information about the dev