|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Writing to Event Log (multiple lines in the description)
with utilities like logevent.exe and eventcreate.exe, but these don't seem to be able to produce messages that span more than one line. An example of a description that I need to duplicate: Description: The VB Application identified by the event source logged this Application xyz: Thread ID: 3420 ,Logged: Source: [xyz] Area: [xyz: App Server Request Failed] Error Code: [-2147012867] Message: [A connection with the server could not be established] How can I do this? Can it be done with some kind of scripting or will I have to get deeper into VB? I then need to figure out how I can script to search for these multi-line events... Marco marco AT nbnet DOT nb DOT ca Hello Marco,
"Marco Shaw" <ma***@Z.nbnet.nb.ca> schrieb im Newsbeitrag news:%23w6wSrXVFHA.3024@TK2MSFTNGP14.phx.gbl... try it like this:>I want to write events to the Event Log for testing purposes. (...) > > I then need to figure out how I can script to search for these multi-line > events... 'script to write to application eventlog dim oWSH dim sMsg set oWSH=CreateObject("WScript.Shell") sMsg="Line1" & vbCrLf & vbCrLf & "Line2" oWSH.logevent 4, sMsg wscript.quit Martin Try this for scripts.
Dim sh Set sh = CreateObject("WScript.Shell") strmeszage = "This Is line 1" & VbCrLf & " This is Line 2" iEventID = 2 '0,1,2 strComputer = "omega" sh.LogEvent iEventID,strmeszage, strComputer -- Show quoteJim Vierra "Marco Shaw" <ma***@Z.nbnet.nb.ca> wrote in message news:%23w6wSrXVFHA.3024@TK2MSFTNGP14.phx.gbl... >I want to write events to the Event Log for testing purposes. I've played > with utilities like logevent.exe and eventcreate.exe, but these don't seem > to be able to produce messages that span more than one line. > > An example of a description that I need to duplicate: > Description: > > The VB Application identified by the event source logged this Application > xyz: Thread ID: 3420 ,Logged: Source: [xyz] > > Area: [xyz: App Server Request Failed] > > Error Code: [-2147012867] > > Message: [A connection with the server could not be established] > > > > How can I do this? Can it be done with some kind of scripting or will I > have to get deeper into VB? > > > > I then need to figure out how I can script to search for these multi-line > events... > > > > Marco > > marco AT nbnet DOT nb DOT ca > > For command line utilities you can usually add "\n" in the string to cause
inserted line feeds (newline). -- Show quoteJim Vierra "Marco Shaw" <ma***@Z.nbnet.nb.ca> wrote in message news:%23w6wSrXVFHA.3024@TK2MSFTNGP14.phx.gbl... >I want to write events to the Event Log for testing purposes. I've played > with utilities like logevent.exe and eventcreate.exe, but these don't seem > to be able to produce messages that span more than one line. > > An example of a description that I need to duplicate: > Description: > > The VB Application identified by the event source logged this Application > xyz: Thread ID: 3420 ,Logged: Source: [xyz] > > Area: [xyz: App Server Request Failed] > > Error Code: [-2147012867] > > Message: [A connection with the server could not be established] > > > > How can I do this? Can it be done with some kind of scripting or will I > have to get deeper into VB? > > > > I then need to figure out how I can script to search for these multi-line > events... > > > > Marco > > marco AT nbnet DOT nb DOT ca > > |
|||||||||||||||||||||||