PSLog | Logger written for Powershell
kandi X-RAY | PSLog Summary
kandi X-RAY | PSLog Summary
The level of logging that should be written to file. INFO/DEBUG/WARN/ERROR/FATAL. Whether or not logging should also be output to console. The amount of files to rotate before overwriting old logs. The max size of the log file before its rotated. The name of the logfile to be used. Will belogged to \logs\. The pattern of the log entries. %d% %t% [%lvl%]: %log_data%. Pattern for date (1). Pattern for timestamp (1). Regular expression of where the .xml file is saved. The encoding the content of the content in the logfile. Possible encodings can be retrieved with [System.Text.Encoding]::GetEncodings().
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of PSLog
PSLog Key Features
PSLog Examples and Code Snippets
Community Discussions
Trending Discussions on PSLog
QUESTION
Because of reasons, I have a situation in which I need to use a .js file to call a .bat file, which calls a .ps1 file. It may sound crazy, but yes, I have to launch the .ps1 file this way.
My problem is that, the .js file is hanging after writing a variable number of errors. The number of errors that causes the script to hang changes between scripts, but seems to be consistent within a script.
I have included sanitized scripts below.
Every time I run this particular combo using cscript (cscript c:\temp\test.js "c:\temp\test3.bat"), the script stops after writing "Checking device 10 of 100." to the log file and does not return me to the prompt. If I run the .bat file from the same command prompt, the script runs as expected. If, on line 41 of the .ps1 script, I change the message type from "Error" to "Verbose" (for example), the script runs fine and completes as expected.
It seems that the .js file does not like something about "Write-Error $Message
" from the Out-PsLogging function but:
- I cannot tell what it doesn't like
- I cannot tell why it stops writing errors after (in this case) 10 errors
I have seen this behavior on Windows 10 and Server 2019 (ps 5.1).
Code:
...ANSWER
Answered 2020-Jun-09 at 12:15Turns out the issue is a bug in wscript: https://groups.google.com/forum/#!topic/microsoft.public.scripting.wsh/kIvQsqxSkSk
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install PSLog
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page