Jump to content

Search the Community

Showing results for tags 'logging'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 7 results

  1. Version 3.16

    678 downloads

    LOG UDF, with or without GUI. Main focus is to keep it simple, so you have just to include _gollog.au3 and call: GOLLOG("a line of text"), and start logging. If your script is without GUI the log will be only written to disk, if you have a GUI you can initialize an edit control : GOLLOG_INI($guititle, $left, $top, $width, $height) and GOLLOG() will write your log both in an auto generated EDIT control in your $guititle GUI and disk; also GOLLOG_INI() will AUTO-create a GUI (if it doesn't exist $guititle) with a screen log if you want ! The majority of options (colors, fonts, position of logs ) are default-defined, but you can initialize them with GOLLOG_INI(), is all documented in the UDF and partially in the example.
  2. Hello! I've been checking the logging UDFs in the wiki, mostly Log4a and Loga and I wanted to ask which one would you recommend for a script that will be executed remotely through PSExec. My main question is where the logs are located in that situation and if I can change that location to a custom one., because I need to retrieve them at the end of execution. So in a rough description the process is Open PSExec Send compiled AutoIT script to remote machine Execute script Copy logs from the remote to the local machine. Any opinions?
  3. I routinely need to log information for my scripts. In the past, I've usually just created functions in each script to write to a log file. I also use ConsoleWrite in conjunction with SciTE a lot when I'm trying to debug scripts. After using some logging libraries for other languages (namely NLog (C#) and Java (log4j)) I decided to write a logging UDF for AutoIt. I decided to base it loosely upon the log4j and NLog libaries. I say loosely because this one is not nearly as feature rich as either one of those, but I think it still provides a nice logging interface. What can it do? Output types: Console, File, or Both. Additionally, you can configure the logger to output differently based on whether the script is compiled or not. This way you can output to the console (SciTE) while you're writing a script, and output to a log file when you've compile the script. Log levels: While I don't think it's really necessary to have this many log levels, these are the levels in ascending order of severity: Trace Debug Info Warn Error Fatal Log Filtering: The log can be enabled and disabled. There are also minimum and maximum log levels that can be configured to only show a range of log levels (i.e. a minimum level of warn would not log messages for trace, debug, or info). These filter levels can be overridden when logging a message if the need be. Error Stream: Logging can be configured to write to the stderr (i.e. ConsoleWriteError). When enabled, any log messages at the error level and above will be written to the error stream. Message Format Macros: The logging message format can be customized to your liking using the following macros: ${date} = Long date (i.e. MM/DD/YYYY HH:MM:SS) ${host} = Hostname of local machine ${level} = The current log level ${message} = The log message ${newline} = Insert a newline ${shortdate} = Short date (i.e. MM/DD/YYYY) Available Functions: Configuration Functions _log4a_SetCompiledOutput - Sets the logging output type for the compiled version of the script (Default: $LOG4A_OUTPUT_FILE) _log4a_SetEnable - Enables or disables logging messages (Default: Disabled) _log4a_SetErrorStream - Enables or disables logging of the standard error stream (Default: Enabled) _log4a_SetFormat - Configures the format of logging messages (Default: "${date} ${level} ${message}") _log4a_SetLogFile - Sets the path of the log file (Default: "<ScriptFullPath>.log") _log4a_SetMaxLevel - Configures the maximum log level to process messages (Default: $LOG4A_LEVEL_FATAL) _log4a_SetMinLevel - Configures the minimum log level to process messages (Default: $LOG4A_LEVEL_TRACE) _log4a_SetOutput - Sets the logging output type for the non-compiled version of the script (Default: $LOG4A_OUTPUT_CONSOLE) Logging Functions _log4a_Debug - Logs a message at the debug level _log4a_Error - Logs a message at the error level _log4a_Fatal - Logs a message at the fatal level _log4a_Info - Logs a message at the info level _log4a_Message - Logs a message to the configured outputs _log4a_Trace - Logs a message at the trace level _log4a_Warn - Logs a message at the warn level See the source file for full documentation of available functions. A quick example script: #include "log4a.au3" ; Enable logging and don't write to stderr _log4a_SetEnable() _log4a_SetErrorStream(False) log_messages() ; Write to stderr, set min level to warn, customize message format _log4a_SetErrorStream() _log4a_SetMinLevel($LOG4A_LEVEL_INFO) If @compiled Then _log4a_SetMinLevel($LOG4A_LEVEL_WARN) ; Change the min level if the script is compiled _log4a_SetFormat("${shortdate} | ${host} | ${level} | ${message}") log_messages() ; Disable logging (except for those that override) _log4a_SetEnable(False) log_messages() Func log_messages() _log4a_Trace("A TRACE message", True) ; overrides filters _log4a_Debug("A DEBUG message") _log4a_Info("A INFO message") _log4a_Warn("A WARN message") _log4a_Error("A ERROR message", True) ; overrides filters _log4a_Fatal("A FATAL message") EndFunc Without further adieu, the UDF: log4a.au3
  4. Hi all, Long time lurker and now forum poster! I'm writing a relatively simple backup script for my firm that automates the copy, compression and organization of Leaver's data on one of our secured NAS systems. I personally found the best method to do this so far was to use 7zG.exe (GUI version of 7Zip which can use command-line too) and it functions quite well! I would like to retrieve more info on whether any warnings or errors happen in 7Zip during the backup, but I can't quite get my head around the syntax and switches for reading out, it seems any adjustment I make to the RunWait call's string seems to break the backup or give unexpected repercussions! Hopefully its something silly I'm doing as I don't code very often. Here is the working version: ; Compress the directories one by one in the zip using the listfile.... Local $iPID = RunWait(@ScriptDir & "\bin\7zG.exe a -mx" & $compressionQuality & " -v" & $compressSplitFileSize & " -wc:\temp " _ & $backupToLocation & "\" & $userDirectory & ".7z @bin\listfile.txt -x@bin\excludefile.txt", "", @SW_SHOWDEFAULT, $STDOUT_CHILD) Ultimately I would love to switch entirely to 7za.exe (standalone) so that I can read the progress percentage, current file being uploaded and any warnings or errors could be processed and output to the AutoIT script's GUI I've created rather than jumping in and out of two applications per se.
  5. Hi all, Bit of a fun one with querying WMI objects and setting errors within a function. Below is example code that I've used from JSThePatriot previous UDFs but the example would apply to many other scenarios. Basically the SetError should be called if $colItems is not an object as a result of the WMI query. This is then used to create a corresponding error message. I've tried disabling WMIC thus forcing it to not be an object, but rather than catching the error and telling me about it, the code simply fails therefore surely making the purpose of the logging useless?? I've experienced this before but in other languages such as java i would use a try catch etc and get around this....any suggestions for its use in AutoIT? Thanks #region Header #comments-start Title: Computer Information Automation UDF Library for AutoIt3 - EXAMPLES Filename: CompInfoExamples.au3 Description: Examples using the UDF's from CompInfo.au3 Author: Jarvis J. Stubblefield (JSThePatriot) http://www.vortexrevolutions.com/ Version: 00.03.08 Last Update: 11.09.06 Requirements: AutoIt v3.2 +, Developed/Tested on WindowsXP Pro Service Pack 2 Notes: Errors associated with incorrect objects will be common user errors. AutoIt beta 3.1.1.63 has added an ObjName() function that will be used to trap and report most of these errors. Special thanks to Firestorm (Testing, Use), Koala (Testing, Bug Fix), and everyone else that has helped in the creation of this Example File. #comments-end #endregion Header #region Global Variables and Constants If Not(IsDeclared("$cI_CompName")) Then Global $cI_CompName = @ComputerName EndIf Global Const $cI_VersionInfo = "00.03.08" Global Const $cI_aName = 0, _ $cI_aDesc = 4 Global $wbemFlagReturnImmediately = 0x10, _ ;DO NOT CHANGE $wbemFlagForwardOnly = 0x20 ;DO NOT CHANGE Global $ERR_NO_INFO = "Array contains no information", _ $ERR_NOT_OBJ = "$colItems isnt an object" #endregion Global Variables and Constants #Region Boot Configuration Dim $BootConfig _ComputerGetBootConfig($BootConfig) If @error Then $error = @error $extended = @extended Switch $extended Case 1 _ErrorMsg($ERR_NO_INFO) Case 2 _ErrorMsg($ERR_NOT_OBJ) EndSwitch EndIf For $i = 1 To $BootConfig[0][0] Step 1 MsgBox(0, "Test _ComputerGetBootConfig", "Name: " & $BootConfig[$i][0] & @CRLF & _ "Boot Directory: " & $BootConfig[$i][1] & @CRLF & _ "Configuration Path: " & $BootConfig[$i][2] & @CRLF & _ "Last Drive: " & $BootConfig[$i][3] & @CRLF & _ "Description: " & $BootConfig[$i][4] & @CRLF & _ "Scratch Directory: " & $BootConfig[$i][5] & @CRLF & _ "Setting ID: " & $BootConfig[$i][6] & @CRLF & _ "Temp Directory: " & $BootConfig[$i][7]) Next #endregion Boot Configuration #region ---- Internal Functions Func _ErrorMsg($message, $time = 0) MsgBox(48 + 262144, "Error!", $message, $time) ConsoleWrite("Error!" & $message & $time & @CRLF) EndFunc #endregion Internal Functions Func _ComputerGetBootConfig(ByRef $aBootConfigInfo) Local $colItems, $objWMIService, $objItem Dim $aBootConfigInfo[1][8], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_Compname & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BootConfiguration", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems ReDim $aBootConfigInfo[UBound($aBootConfigInfo) + 1][8] $aBootConfigInfo[$i][0] = $objItem.Name $aBootConfigInfo[$i][1] = $objItem.BootDirectory $aBootConfigInfo[$i][2] = $objItem.ConfigurationPath $aBootConfigInfo[$i][3] = $objItem.LastDrive $aBootConfigInfo[$i][4] = $objItem.Description $aBootConfigInfo[$i][5] = $objItem.ScratchDirectory $aBootConfigInfo[$i][6] = $objItem.SettingID $aBootConfigInfo[$i][7] = $objItem.TempDirectory $i += 1 Next $aBootConfigInfo[0][0] = UBound($aBootConfigInfo) - 1 If $aBootConfigInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Else SetError(1, 2, 0) EndIf EndFunc ;_ComputerGetBootConfig
  6. Hello Auto IT I wanna keep it short, so let's get started. I like to store my account details for various sites and programs on a simple log file, It's personal preference and I know it's risky. I'm using somewhat a "form" when I'm typing in my accounts, so that It's easier for me to keep track on what site/program the account is for. The form looks somewhat like this: Would it be possible to create a script in which makes a UI where i can type in those fields, and it will automaticly add it to my log file? I would love to know how this could work, and what kind commands i should look into. - AliOzturk
  7. Its been asked before and I can't seem to find any UDF or built in feature with support for Logging in AutoIt, but I thought it wouldn't hurt to ask and spark some focus on the matter. Applications built for in house use to be run by those that develop them really isn't an issue. It becomes useful to troubleshoot an application if it utilizes some sort of Logging. It is feasible to write functions to support such a need, but I would be pleased if I could find someone who is a far better programmer than I had visited this so I don't have to divert attention and implement it into projects. What I'm looking for is something similar to NLog or Log4Net with the ability to log events as they happen for ease of troubleshooting if an application fails. I'm aware of Opt("GUIOnEventMode", 1) but that isn't useful if the end user is not the developer and where screenshots are not desired. I'm not trying to compare Autoit to .NET in any way. I'm just trying to achieve logging capabilities that match those applications mentioned. I have considered AutoItX and recoding the project in .NET except for the components that are essentially AutoIt only capable, but that is a bit extreme for my immediate needs.
×
×
  • Create New...