Monday, March 28, 2011

Adding custom log locations to the OS X console application...

After searching online, the best solution I've found so far is to just make a symbolic link in either "/Library/logs/" or "~/Library/logs/" to get it to show up in the Console application.

I'm wondering if it would be possible to add a new directory or log file to the "root" level directly under the "LOG FILES" section in the console.

Here's a quick screenshot:

OS X Console

From stackoverflow
  • I don't believe it's possible.

    If you're generating log files, you should generate them into one of the standard locations anyway, so this won't be an issue.

  • There is one way to get you log files into the console.

    You can add a symlink to the log file or log directory to one of the directories in the list. The directory ~/Library/Logs seems like the logical choice for adding your own log files.


    For myself I wanted easy access to apache2 logs. I installed apache2 using macports and the default log file is located at /opt/local/apache2/logs.

    Thus all I did was create the symlink to that directory.

    # cd ~/Library/Logs
    # ln -s /opt/local/apache2/logs/ apache2
    

    Now I can easily use the console.app to get to the logs.

  • In Terminal run this command... append any log file directories you want to add

    defaults write com.apple.Console LogFolderPaths -array '~/Library/Logs/' '/Library/Logs/' '/var/log/' '/opt/local/var/log/'

    Ted Naleid : This didn't seem to work for me on Leopard 1.5.7, am I missing something?
    Wilco : Doesn't work for me either (sasme OS/version) - any ideas?
    sholsinger : Sorry I thumbed it up before trying. That default doesn't exist.
  • I actually just came across this option that worked perfectly for me:

    Actually if you open terminal and...

    $ cd /Library/Logs

    then sym-link to your new log directory. eg i want my chroot'ed apache logs as 'www'

    $ ln -s /chroot/apache/private/var/log www

    then re-open Console.app

    drill down into /Library/Logs and you will find your sym-linked directory.

    ;-)

    Mohclips.

    http://forums.macosxhints.com/showthread.php?t=35680

0 comments:

Post a Comment