During upgrade from PostgreSQL 8.4.8 to PostgreSQL 9.5.2 on Windows OS, i got the following error over command line:
Running in verbose mode
cannot write to log file pg_upgrade_internal.log
Failure, exiting
When I checked the file pg_upgrade_internal.log, it contained following data:
Running in verbose mode
-----------------------------------------------------------------
  pg_upgrade run on Tue Apr 24 17:02:13 2018
-----------------------------------------------------------------
Other files like pg_upgrade_server.log , pg_upgrade_utility.log, pg_upgrade_server_start.log, which are generated by pg_upgrade utility, also contain partial data:
-----------------------------------------------------------------
  pg_upgrade run on Tue Apr 24 17:02:13 2018
-----------------------------------------------------------------
If pg_upgrade utility failed to write (or in other words, did not have permission), then who wrote the above data ? I am sure that these logs were written by PostgreSQL utility only.
BTW, I have already checked the Stackoverflow, PostgreSQL site links (link1, link2, etc.) which describe the cannot write... error issue, but none of those links mention this issue/concern.