get errors to a file

Discussions related to using VirtualBox on Windows hosts.
Post Reply
dinodin
Posts: 2
Joined: 27. Nov 2014, 09:23

get errors to a file

Post by dinodin »

Hello, I'm using Virtual Box 4.1.2.
I'm runing vboxManage.exe to run vBox command from another application with scripts.

Sometime the command return an error (Like when I am trying to start a machine whice does not exist).

I know that the error is log in a log file in the current user directory.

Is there a way to redirect the errors to a specific file?

Thanks,
Roy
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: get errors to a file

Post by socratis »

dinodin wrote:I know that the error is log in a log file in the current user directory.
How do you know that? Did you do it in the scripts? In any case, that doesn't sound like a VirtualBox problem to me, but maybe I'm wrong. I mean if your script was trying to control MySQL as well, would you be asking here, in the MySQL forums or (IMO) in the forums of your operating system? I'd say the latter...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: get errors to a file

Post by scottgus1 »

Sure enough, the Vboxmanage errors do show up in the VboxSVC.log. I ran a test command "Vboxmanage startvm testme" where testme is not a valid guest name, and got this line in VboxSVC.log:

Code: Select all

29:07:32.562000          ERROR [COM]: aRC=VBOX_E_OBJECT_NOT_FOUND (0x80bb0001) aIID={3b2f08eb-b810-4715-bee0-bb06b9880ad2} aComponent={VirtualBox} aText={Could not find a registered machine named 'testme'}, preserve=false
As for redirecting that error to a different file, I would guess that's not likely to be possible. I haven't come across anything like that in the user manual. (Could have missed it though, it's a big manual)

You're likely going to have to run tests on your commands within your scripts to see, as an example, if the guest you're about to run exists or not.

fwiw, windows command files can redirect the output of commands to disk files using the greater-than symbol, like "dir > myfile.txt" will put the directory listing in myfile.txt instead of showing it on the screen. But Vboxmanage doesn't use that redirecting function for its error output, as I've seen.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: get errors to a file

Post by socratis »

First, the output that you see in your mistaken command is the the 'standard output' (stdout), it is the 'standard error' (stderr). Well, in *nix you could redirect the output of stderr easily with something like:
VBoxManage startvm notavail 2>> ErrorLog.txt
The '2>>' takes the stderr (2) and appends it (>>) to a filed called ErrorLog.txt. It works just fine with VBoxManage. I'll look if there's something analogous for Windows and report back. That would solve the OP's problem, right? That's what I had in mind at the beginning in any event.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: get errors to a file

Post by socratis »

Hey, guess what, Microsoft has the same feature! http://support.microsoft.com/kb/110930
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
dinodin
Posts: 2
Joined: 27. Nov 2014, 09:23

Re: get errors to a file

Post by dinodin »

socratis wrote:Hey, guess what, Microsoft has the same feature! http://support.microsoft.com/kb/110930
Hi socratis,

Thats great, Thanks.
Redirecting useing the 2> writes the error to my own log file and also to the vBox log file.

Thats exactly what I wanted!

Thanks again.

Roy.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: get errors to a file

Post by socratis »

That's great! I learned something in the process as well. I knew about the *nix world, now I know about Windows as well.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply