7 Replies - 1142 Views - Last Post: 26 June 2015 - 06:24 AM Rate Topic: ***-- 2 Votes

#1 iliali16  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 42
  • Joined: 19-December 09

Log file after build with InstallShield disappeared

Posted 24 June 2015 - 03:11 PM

Hi guys,

I have this code for creating a log file.

private void ThreadOutputDoc()
        {
            //Push to Log file
            using (StreamWriter w = File.AppendText(@".\Log.txt"))
            {
                Log(input, w);
                Log(output, w);
            }
            //this.OutputDoc(output);
            SendKeys.SendWait(output);
        }





And the other Log method is:

 public static void Log(string logMessage, TextWriter w)
        {
            w.Write("\r\nLog Entry : ");
            w.WriteLine("{0} {1}", DateTime.Now.ToLongTimeString(),
                DateTime.Now.ToLongDateString());
            w.WriteLine("  :{0}", logMessage);
            w.WriteLine("-------------------------------");
        }



After the build with install shield I have no log file anywhere in the solution folder.
If I run the build from the VS2013 I get the log file in my solution Debug or Release folder depending on which one I run.

Thanks for any help and any suggestions.
Ilia

Is This A Good Question/Topic? 0
  • +

Replies To: Log file after build with InstallShield disappeared

#2 andrewsw  Icon User is offline

  • lashings of ginger beer
  • member icon

Reputation: 6340
  • View blog
  • Posts: 25,565
  • Joined: 12-December 12

Re: Log file after build with InstallShield disappeared

Posted 24 June 2015 - 03:19 PM

Question moved out of C# Discussions. You are asking a question about a problem you are having, not starting a discussion.
Was This Post Helpful? 0
  • +
  • -

#3 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 5825
  • View blog
  • Posts: 19,844
  • Joined: 05-May 12

Re: Log file after build with InstallShield disappeared

Posted 24 June 2015 - 04:01 PM

Where are you installing the program to? If within Program Files, recall that starting with Vista, permissions are restricted within that folder tree.
Was This Post Helpful? 1
  • +
  • -

#4 iliali16  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 42
  • Joined: 19-December 09

Re: Log file after build with InstallShield disappeared

Posted 24 June 2015 - 11:20 PM

It is in program files, so you mean that the folder should be read/write and that is the problem?

This post has been edited by Skydiver: 26 June 2015 - 06:25 AM
Reason for edit:: Removed unnecessary quote. No need to quote the post above yours.

Was This Post Helpful? 0
  • +
  • -

#5 iliali16  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 42
  • Joined: 19-December 09

Re: Log file after build with InstallShield disappeared

Posted 24 June 2015 - 11:43 PM

I also tried to output to @"C:\Log.txt" but with no success.
Was This Post Helpful? 0
  • +
  • -

#6 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 5825
  • View blog
  • Posts: 19,844
  • Joined: 05-May 12

Re: Log file after build with InstallShield disappeared

Posted 25 June 2015 - 04:00 AM

Same deal. With Vista and up, the root of the system drive was also got restricted rights. Other folders that get restricted rights is the Windows tree. The registry also got permissions restricted.

Use the temporary folder as the location for your log file. See Path.GetTempPath(). Alternative use the Program Data folder. See Environment.SpecialFolder.
Was This Post Helpful? 0
  • +
  • -

#7 iliali16  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 42
  • Joined: 19-December 09

Re: Log file after build with InstallShield disappeared

Posted 25 June 2015 - 11:28 PM

Thank you Skydiver, it worked this way!

This post has been edited by Skydiver: 26 June 2015 - 06:25 AM
Reason for edit:: Removed unnecessary quote. No need to quote the post above yours.

Was This Post Helpful? 0
  • +
  • -

#8 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 5825
  • View blog
  • Posts: 19,844
  • Joined: 05-May 12

Re: Log file after build with InstallShield disappeared

Posted 26 June 2015 - 06:24 AM

You do realize that you should have gotten an exception when you tried to write into those restricted areas. Are you just eating all exceptions?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1