How can I make if file exist or in use in that moment to create new one log1, log2,log3 etc. Now when I start app I can`t start second because log file is in use. I must create second log file or somehow write in same file ?
EDIT:
here is solution that works fine for me.
if (String.IsNullOrEmpty(this.LogFile1))
            {
                string fn = "\\log.txt";
                while (File.Exists(fn))
                {
                    fn = "\\log1.txt";
                }
                this.LogFile1 = fn;
            }
            return this.LogFile1;
And a little edit on my code:
 if (!File.Exists(this.LogFile))
            {
                log = new StreamWriter(this.LogFile);
            }
            else
            {
                log = File.AppendText(this.LogFile);
            }
Now if i have log.txt program will create new log1.txt. If they both exist will create log11.txt and so on.
 
     
     
     
     
     
     
    