title: VIM: simple steps to create syntax highlight file - for logfiles
body: <p>I have some (log4j generated) logfiles to go through; I know their format pretty well (I mean I have already got off-the-peg regexes etc I can use).</p>
  
  <p>I want to automatically highlight them in VIM when I load them up (*.log).</p>
  
  <p>A logfile entry looks something like this:</p>
  
  <pre><code>YYYY-MM-DD HH:MM:ss,SSS [...] #LOG-LEVEL# [...] Message
  </code></pre>
  
  <p>Where #LOG-LEVEL# is one of the standard 'ERROR', 'INFO', 'DEBUG', 'FATAL'....and the 'YYYY-MM...' represents the date/time to millisecond resolution.</p>
  
  <p>To get me started , what are the steps needed to get the date-string highlighted in (say) yellow-background with blue text - and also when the  text reads ' ERROR ' this should have a red-background with white text.</p>
  
  <p>I have tried going through some tutorials on this, but can't find one which is simple enough to understand, so I'm after some real basic steps here !</p>
  
  <p>Cheers</p>
  
  <p>EDIT:
  Here's the summary of what I did, based on the instructions below:</p>
  
  <ol>
  <li><p>Created the syntax file 'log.vim' in .vim\syntax (see below for example content).</p></li>
  <li><p>Created a file in .vim\ftdetect\log.vim with the following content:</p>
  
  <p>au BufRead,BufNewFile *.log     set filetype=log</p></li>
  <li><p>Made sure the following are in my startup settings:</p>
  
  <p>syntax on
  filetype on</p></li>
  </ol>