sat6804 Posted February 8, 2016 Share Posted February 8, 2016 Hi All, How to create log file using auto IT scripts. i used one auto it program but which line error occurs unable to find it,how to find errors, it any error occurs in code the log script should write error scripts lines in particular log file . If you anyone know please share sample code.. Thanks, Sat6804 Link to comment Share on other sites More sharing options...
l3ill Posted February 8, 2016 Share Posted February 8, 2016 Hi sat6804, _FileWriteLog Example from the helpfile: ; Open the logfile in write mode. #include <File.au3> Local $hFile = FileOpen(@ScriptDir & "\Example.log", 1) _FileWriteLog($hFile, "Text 1") ; Write to the logfile passing the filehandle returned by FileOpen. FileClose($hFile) ; Close the filehandle to release the file. My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
sat6804 Posted February 9, 2016 Author Share Posted February 9, 2016 Hi , Can you please anyone share how to create logfile for entire script to validate and indciate error lines as write log file . Thanks, Sat6804 Link to comment Share on other sites More sharing options...
JohnOne Posted February 9, 2016 Share Posted February 9, 2016 Would you like anything else while you wait? Radiance 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Radiance Posted February 9, 2016 Share Posted February 9, 2016 5 minutes ago, sat6804 said: Hi , Can you please anyone share how to create logfile for entire script to validate and indciate error lines as write log file . Thanks, Sat6804 There's no general logging for AutoIt, if you want to log stuff you gotta put in the function l3ill provided (or make your own) at the parts of your script you want to observe. Please note that this can blow up your script immensely in terms of clarity and amount of lines. For example: $go_Connection = _MySQLConnect($gs_MySQLHost, $gs_Database, $gs_User, $gs_Password, $gs_Port, $gs_Driver) If $go_Connection = False Then Exit EndIf Becomes: _Serverlog("STRT", 10, "Server starting up.") _Serverlog("STRT", 10, "Connecting to MySQL database " & $gs_Database & " on server " & $gs_MySQLHost & "...") $go_Connection = _MySQLConnect($gs_MySQLHost, $gs_Database, $gs_User, $gs_Password, $gs_Port, $gs_Driver) If $go_Connection = False Then _Serverlog("STRT", 50, "Failed to connect to database.") Exit EndIf _Serverlog("STRT", 10, "Connection established.") Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now