title: Running chromium as headless from shell, how do I get the log for loading the page resources?
body: <p>I have a shell script that runs chromium-browser headless, using it to print html into a pdf file.</p>
  <pre><code>$ chromium-browser --headless --disable-gpu \
      --print-to-pdf=/home/www-data/build/out.pdf \
      /home/www-data/build/out.html
  </code></pre>
  <p>If there are any errors with the page (anything from Javascript errors to unavailable resources), I would like my shell script to behave accordingly. But how do I even tell if such errors occur?</p>
  <p>Below is a screenshot from Chromium, where an environment variable was not set, and therefore the path for the CSS files is incorrect.</p>
  <p><a href="https://i.stack.imgur.com/VBCj6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VBCj6.png" alt="enter image description here" /></a></p>
  <p>I have tried in various ways to get this information out of chrome headless, but without luck.</p>
  <p>My best suggestion is to look for it in the log in userdata, but even with the highest logging level, I don't see that there is anything about not being able to log the resources. All I can find about loading those resources is shown below:</p>
  <pre><code>$ rm /home/www-data/userdata -rf
  $ chromium-browser --headless --disable-gpu \
      --enable-logging 
      --v=4 \
      --user-data-dir=/home/www-data/userdata \
      --print-to-pdf=/home/www-data/build/out.pdf \
      /home/www-data/build/out.html
  $ grep css userdata -r
  userdata/Default/chrome_debug.log:[0921/163104.096612:VERBOSE1:file_url_loader_factory.cc(451)] FileURLLoader::Start: file:///css/bootstrap.css
  userdata/Default/chrome_debug.log:[0921/163104.096746:VERBOSE1:file_url_loader_factory.cc(451)] FileURLLoader::Start: file:///css/email.css
  userdata/Default/chrome_debug.log:[0921/163104.096873:VERBOSE1:file_url_loader_factory.cc(451)] FileURLLoader::Start: file:///css/print_common.css
  userdata/Default/chrome_debug.log:[0921/163104.097021:VERBOSE1:file_url_loader_factory.cc(451)] FileURLLoader::Start: file:///css/print_A4P.css
  </code></pre>