Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does vagrant store logs?

I am trying to do a little debugging as to why my vagrant box is throwing errors when I do vagrant up.

On windows I have:

$ set VAGRANT_LOG=info 
$ vagrant up

Where does vagrant store the log file?

like image 774
Eric Francis Avatar asked Oct 15 '14 14:10

Eric Francis


3 Answers

For Virtual Box provider, the logs are stored at ~/VirtualBox VMs/vagrant_box_name/Logs.

There is a VBox.log and a VBoxStartup.log.

I think @balintant is right too, as these are not 'vagrant' logs, but Virtual Box logs (which is what I was really looking for).

like image 65
Eric Francis Avatar answered Oct 23 '22 17:10

Eric Francis


As far as I know vagrant does not write into logfiles, it only has output to stdout.

PS.: I Googled it and found nothing - even in the Vagrant documentations -, so I think I am right.

like image 30
balintant Avatar answered Oct 23 '22 16:10

balintant


I work with Vagrant on a POSIX OS (Mac/Linux) but I was able to find Windows PowerShell equivalent(?) commands. I don't work in Windows so you'll have to test these things yourself.

Within the current working directory (I just happen to be experimenting with CoreOS at the moment):

List the contents of your directory; Linux:

$ ll
...
-rw-rw-r--. 1 myAcct myGroup 3.3K Nov 22 15:33 config.rb
-rw-rw-r--. 1 myAcct myGroup 1.3K Nov 22 16:43 vagrant-info.out
-rw-rw-r--. 1 myAcct myGroup 1.1K Nov 22 16:42 myAcct-data
-rw-rw-r--. 1 myAcct myGroup 4.6K Nov 22 16:05 Vagrantfile
-rw-rw-r--. 1 myAcct myGroup  306 Nov 22 16:47 vagrant.env

Windows:

Get-ChildItem -Force C:\dir\path

I use the vagrant.env file to record/use/reuse experiment-specific environment variables. It looks like this; Linux:

$ cat vagrant.env 
# Environment Variables on a per-experiment basis
# Name a non-default Vagrant Provider:
#export VAGRANT_DEFAULT_PROVIDER='vmware_fusion'
# Which CoreOS channel
export channel='channel=stable'
# Set a log level for troubleshooting: debug or info
export VAGRANT_LOG='info'
#export VAGRANT_DEBUG_LAUNCHER

Windows: (I belive type is as close as you can get)

C:\> type vagrant.env 

These variables can then be introduced into the environment; Linux:

source vagrant.env

Windows:

. .\vagrant.env

After that, start Vagrant; Linux:

vagrant up | tee -ai vagrant-log-info.out

On Windows the Tee-Object might work like this:

vagrant up  | Tee-Object -file vagrant-log-info.out

On Linux, this method will drop a log named (something meaningful): vagrant-log-info.out

I can then read that log, save it for posterity or whatever. I hope this helps.

Please feel free to update this with tested versions of these commands. I can imagine it must be a fairly common need.

like image 3
todd_dsm Avatar answered Oct 23 '22 18:10

todd_dsm