Is there a log4j equivalent for VBScript?

I need to process a series of .wsf and .vbs files with debuggers; before I leave and download my own, is there something like log4j for WSF / VBScript?

+4
source share
3 answers

Since my main program is the Windows Script File (.wsf) script, I can include and use code from other scripting languages.

I found Log4js: JavaScript logging framework modeled after Log4j, which works very well for me. I had to add my own Appender to log into stderr and stdout , but it was much easier than creating my own logging environment from scratch.

UPDATE: 2/13/2009:

Log4js: JavaScript logging framework First I tried to be a bit resource intensive. I found another implementation of JavaScript Log4js at http://log4js.sourceforge.net/ , which is much more stable and efficient.

+1
source

Not comparable to log4j, but with what you can start:

VBScript reusable login - LogToFile.vbs

In any place where you want to register a message in a script, you would simply add LogToFile "Your message" to register the relevant information.

With this script, you can record the date and time when you started the script, the date and time of the events, and generate unique file names if you want to schedule the script to run. It is also easy to disable logging without editing the entire log section.

If you want to write to the event log, you can do this using the WshShell object . It provides a LogEvent method for logging events in the application event log.

The LogEvent method allows you to log events from your scripts. LogEvent has two required parameters. The first parameter of the LogEvent method is an integer that indicates the type of event that you would like to write to the script log.

 Set objShell = WScript.CreateObject("Wscript.Shell") objShell.LogEvent 0,"Test Success Event" objShell.LogEvent 1,"Test Error Event" objShell.LogEvent 2,"Test Warning Event" objShell.LogEvent 4, "Test Information Event" objShell.LogEvent 8, "Test Success Audit Event" objShell.LogEvent 16, "Test Failure Audit Event" 

See here at Microsoft TechNet .

+2
source

I suspect you can use Log4net through COM. This is the .net version of log4J, and I highly recommend it as a registration framework. There is some information here.

0
source

All Articles