How can I relocate or disable the VirtualBox logfile when starting a vm from Vagrant?












1















When I run vagrant up using VirtualBox as a provider, it creates a logfile called ubuntu-xenial-16.04-cloudimg-console.log in the project root. This causes difficulty with PHPStorm, as it doesn't have an option to exclude individual files from search, only folders.



I would like to have this logfile created in the _log directory instead, but I cannot find how to configure its location; there doesn't seem to be anything in the Vagrantfile documentation, and I can't find an option in the VirtualBox GUI.



I've also tried symlinking the file to /dev/null, but VirtualBox refuses to even start if the link is there. I can't simply delete the file while the VM is up, as it holds a lock on it.



A simplified version of the Vagrantfile is below:



# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"

config.disksize.size = "10GB"

config.vm.network "forwarded_port", guest: 80, host: 80, host_ip: "127.0.0.1"
config.vm.network "forwarded_port", guest: 3306, host: 3306, host_ip: "127.0.0.1"

config.vm.synced_folder ".", "/var/www/html"

config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = "2048"
end

config.vm.provision "shell", inline: <<-SHELL
# redacted
SHELL
end


How can I change the log location? Or, if that's possible, how can I prevent it from being generated in the first place?










share|improve this question



























    1















    When I run vagrant up using VirtualBox as a provider, it creates a logfile called ubuntu-xenial-16.04-cloudimg-console.log in the project root. This causes difficulty with PHPStorm, as it doesn't have an option to exclude individual files from search, only folders.



    I would like to have this logfile created in the _log directory instead, but I cannot find how to configure its location; there doesn't seem to be anything in the Vagrantfile documentation, and I can't find an option in the VirtualBox GUI.



    I've also tried symlinking the file to /dev/null, but VirtualBox refuses to even start if the link is there. I can't simply delete the file while the VM is up, as it holds a lock on it.



    A simplified version of the Vagrantfile is below:



    # -*- mode: ruby -*-
    # vi: set ft=ruby :

    Vagrant.configure("2") do |config|
    config.vm.box = "ubuntu/xenial64"

    config.disksize.size = "10GB"

    config.vm.network "forwarded_port", guest: 80, host: 80, host_ip: "127.0.0.1"
    config.vm.network "forwarded_port", guest: 3306, host: 3306, host_ip: "127.0.0.1"

    config.vm.synced_folder ".", "/var/www/html"

    config.vm.provider "virtualbox" do |vb|
    vb.gui = false
    vb.memory = "2048"
    end

    config.vm.provision "shell", inline: <<-SHELL
    # redacted
    SHELL
    end


    How can I change the log location? Or, if that's possible, how can I prevent it from being generated in the first place?










    share|improve this question

























      1












      1








      1








      When I run vagrant up using VirtualBox as a provider, it creates a logfile called ubuntu-xenial-16.04-cloudimg-console.log in the project root. This causes difficulty with PHPStorm, as it doesn't have an option to exclude individual files from search, only folders.



      I would like to have this logfile created in the _log directory instead, but I cannot find how to configure its location; there doesn't seem to be anything in the Vagrantfile documentation, and I can't find an option in the VirtualBox GUI.



      I've also tried symlinking the file to /dev/null, but VirtualBox refuses to even start if the link is there. I can't simply delete the file while the VM is up, as it holds a lock on it.



      A simplified version of the Vagrantfile is below:



      # -*- mode: ruby -*-
      # vi: set ft=ruby :

      Vagrant.configure("2") do |config|
      config.vm.box = "ubuntu/xenial64"

      config.disksize.size = "10GB"

      config.vm.network "forwarded_port", guest: 80, host: 80, host_ip: "127.0.0.1"
      config.vm.network "forwarded_port", guest: 3306, host: 3306, host_ip: "127.0.0.1"

      config.vm.synced_folder ".", "/var/www/html"

      config.vm.provider "virtualbox" do |vb|
      vb.gui = false
      vb.memory = "2048"
      end

      config.vm.provision "shell", inline: <<-SHELL
      # redacted
      SHELL
      end


      How can I change the log location? Or, if that's possible, how can I prevent it from being generated in the first place?










      share|improve this question














      When I run vagrant up using VirtualBox as a provider, it creates a logfile called ubuntu-xenial-16.04-cloudimg-console.log in the project root. This causes difficulty with PHPStorm, as it doesn't have an option to exclude individual files from search, only folders.



      I would like to have this logfile created in the _log directory instead, but I cannot find how to configure its location; there doesn't seem to be anything in the Vagrantfile documentation, and I can't find an option in the VirtualBox GUI.



      I've also tried symlinking the file to /dev/null, but VirtualBox refuses to even start if the link is there. I can't simply delete the file while the VM is up, as it holds a lock on it.



      A simplified version of the Vagrantfile is below:



      # -*- mode: ruby -*-
      # vi: set ft=ruby :

      Vagrant.configure("2") do |config|
      config.vm.box = "ubuntu/xenial64"

      config.disksize.size = "10GB"

      config.vm.network "forwarded_port", guest: 80, host: 80, host_ip: "127.0.0.1"
      config.vm.network "forwarded_port", guest: 3306, host: 3306, host_ip: "127.0.0.1"

      config.vm.synced_folder ".", "/var/www/html"

      config.vm.provider "virtualbox" do |vb|
      vb.gui = false
      vb.memory = "2048"
      end

      config.vm.provision "shell", inline: <<-SHELL
      # redacted
      SHELL
      end


      How can I change the log location? Or, if that's possible, how can I prevent it from being generated in the first place?







      virtualbox vagrant






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 31 '18 at 9:31









      John YJohn Y

      15018




      15018






















          1 Answer
          1






          active

          oldest

          votes


















          1














          I managed to change the log file location as per this post. To change the log file location to a folder called /temp relative to my Vagrantfile, I added this to the Vagrantfile (inside the Vagrant.configure(2) do |config| - section):



          config.vm.provider "virtualbox" do |vb|
          vb.customize [
          "modifyvm", :id, "--uartmode1", "file",
          File.join(Dir.pwd, "temp/ubuntu-xenial-16.04-cloudimg-console.log")
          ]
          end


          This seems to override the current location settings. The temp-folder
          must already be present.



          To completely disable the log file output, follow the recipe from the above link:



          config.vm.provider "virtualbox" do |vb|
          vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]
          end





          share|improve this answer

























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1354068%2fhow-can-i-relocate-or-disable-the-virtualbox-logfile-when-starting-a-vm-from-vag%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            I managed to change the log file location as per this post. To change the log file location to a folder called /temp relative to my Vagrantfile, I added this to the Vagrantfile (inside the Vagrant.configure(2) do |config| - section):



            config.vm.provider "virtualbox" do |vb|
            vb.customize [
            "modifyvm", :id, "--uartmode1", "file",
            File.join(Dir.pwd, "temp/ubuntu-xenial-16.04-cloudimg-console.log")
            ]
            end


            This seems to override the current location settings. The temp-folder
            must already be present.



            To completely disable the log file output, follow the recipe from the above link:



            config.vm.provider "virtualbox" do |vb|
            vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]
            end





            share|improve this answer






























              1














              I managed to change the log file location as per this post. To change the log file location to a folder called /temp relative to my Vagrantfile, I added this to the Vagrantfile (inside the Vagrant.configure(2) do |config| - section):



              config.vm.provider "virtualbox" do |vb|
              vb.customize [
              "modifyvm", :id, "--uartmode1", "file",
              File.join(Dir.pwd, "temp/ubuntu-xenial-16.04-cloudimg-console.log")
              ]
              end


              This seems to override the current location settings. The temp-folder
              must already be present.



              To completely disable the log file output, follow the recipe from the above link:



              config.vm.provider "virtualbox" do |vb|
              vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]
              end





              share|improve this answer




























                1












                1








                1







                I managed to change the log file location as per this post. To change the log file location to a folder called /temp relative to my Vagrantfile, I added this to the Vagrantfile (inside the Vagrant.configure(2) do |config| - section):



                config.vm.provider "virtualbox" do |vb|
                vb.customize [
                "modifyvm", :id, "--uartmode1", "file",
                File.join(Dir.pwd, "temp/ubuntu-xenial-16.04-cloudimg-console.log")
                ]
                end


                This seems to override the current location settings. The temp-folder
                must already be present.



                To completely disable the log file output, follow the recipe from the above link:



                config.vm.provider "virtualbox" do |vb|
                vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]
                end





                share|improve this answer















                I managed to change the log file location as per this post. To change the log file location to a folder called /temp relative to my Vagrantfile, I added this to the Vagrantfile (inside the Vagrant.configure(2) do |config| - section):



                config.vm.provider "virtualbox" do |vb|
                vb.customize [
                "modifyvm", :id, "--uartmode1", "file",
                File.join(Dir.pwd, "temp/ubuntu-xenial-16.04-cloudimg-console.log")
                ]
                end


                This seems to override the current location settings. The temp-folder
                must already be present.



                To completely disable the log file output, follow the recipe from the above link:



                config.vm.provider "virtualbox" do |vb|
                vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]
                end






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 18 at 11:55

























                answered Jan 17 at 13:56









                jonasfhjonasfh

                17614




                17614






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1354068%2fhow-can-i-relocate-or-disable-the-virtualbox-logfile-when-starting-a-vm-from-vag%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Index of /

                    Tribalistas

                    Listed building