Sign in to follow this  
Followers 0
bourny

LogFiles

3 posts in this topic

I am looking to improve my script log file function. This function is quite basic and simply does the following

$Logfile = "Testscript.log"

$WorkingLogFile = FileOpen ("c:\YMpkg\Logs\" & $LogFile , 2)

I then send messages to the log file in the following way.

FileWriteLine($WorkingLogFile, $Time)

FileWriteLine($WorkingLogFile, $date)

FileWriteLine($WorkingLogFile, "....Starting installation function")

Etc ...

The issue with this is if the script falls over and terminates or the user / OS kills the process the log file will be empty. I can get around this by writing a function that opens and closes the logfile for each message but I fiure this isnt very efficient and there must be a better way to do this...

Any ideas appreciated....

Share this post


Link to post
Share on other sites



Thanks ...

Works a treat... Give yourself a pat on the back and I will slp myself for not finding this in the help file ...

Many Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0