You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running geoipudate -v, I noticed that it prints to stderr instead of stdout. I ran into this issue when trying to print output to a log file.
Example 1: geoipupdate -v 1>/var/www/test.txt
terminal:
Using config file /usr/local/etc/GeoIP.conf
Using database directory {DATABASE_DIR}
Performing get filename request to https://updates.maxmind.com/app/update_getfilename?product_id=GeoLite2-City
Acquired lock file lock ({FILE_PATH}/.geoipupdate.lock)
Calculated MD5 sum for {FILE_PATH}/GeoLite2-City.mmdb: d90975ccfa5460d7ee2b2a9a4ebd93ae
Performing update request to https://updates.maxmind.com/geoip/databases/GeoLite2-City/update?db_md5=d90975ccfa5460d7ee2b2a9a4ebd93ae
No new updates available for GeoLite2-City
test.txt:
// empty
Example 2: geoipupdate -v 2>/var/www/test.txt
terminal:
// empty
test.txt
Using config file /usr/local/etc/GeoIP.conf
Using database directory {DATABASE_DIR}
Performing get filename request to https://updates.maxmind.com/app/update_getfilename?product_id=GeoLite2-City
Acquired lock file lock ({FILE_PATH}/.geoipupdate.lock)
Calculated MD5 sum for {FILE_PATH}/GeoLite2-City.mmdb: d90975ccfa5460d7ee2b2a9a4ebd93ae
Performing update request to https://updates.maxmind.com/geoip/databases/GeoLite2-City/update?db_md5=d90975ccfa5460d7ee2b2a9a4ebd93ae
No new updates available for GeoLite2-City
Possible Solution:
Instead of of using log.Printf() for verbose flag output, use fmt.Printf()
The text was updated successfully, but these errors were encountered:
I agree it can be unexpected, but I don't know that it's necessarily a bug or necessary to change. stderr is often used this way, e.g. see its description on https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html ("standard error (for writing diagnostic output)").
Vote for using stdout for such messages too - it is just additional information, not errors IMO. As for me, it breaks automation (e.g. ansible playbooks) logic, - it's just weird to check stderr if new update was received or not.
Bug:
When running
geoipudate -v
, I noticed that it prints to stderr instead of stdout. I ran into this issue when trying to print output to a log file.Example 1:
geoipupdate -v 1>/var/www/test.txt
terminal:
test.txt:
Example 2:
geoipupdate -v 2>/var/www/test.txt
terminal:
test.txt
Possible Solution:
Instead of of using
log.Printf()
for verbose flag output, usefmt.Printf()
The text was updated successfully, but these errors were encountered: