27

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

11 Answers 11

43

There is one way to get your 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.

7
  • 3
    It looks like Mountain Lion removes this feature. Console doesn't display symlinks at all, any more. Oct 11, 2012 at 13:44
  • This worked for me in Mountain Lion. Only problem was that I had to manually grant read access to those files before they were readable in Consoe.app Dec 17, 2012 at 12:03
  • Works for me in 10.8.4
    – Elliott B
    Sep 3, 2013 at 17:32
  • 8
    On OSX 10.9 I can't have a symbolic link to a folder, but a folder contains symbolic link for each files works. I use it for MAMP logs
    – mems
    Dec 16, 2013 at 14:59
  • 2
    Doesn't seem to work on macOS 10.12... Tried for both folders and single files (MongoDB log files). Oct 28, 2016 at 9:06
8

My solution for macOS Sierra:

First and last step, you must create a hard link from your source (log) directory into (as example) one of existing official log directories, you can seen in console.app.

I take my ~/Library/Logs directory for that.

hln /usr/local/var/log /Users/dierk/Library/Logs/_usr_local_var_log

Cross-posting this great tool for creating hardlinks originally posted by Sam.

Short intro:

To install Hardlink, ensure you've installed homebrew, then run:

brew install hardlink-osx

Once installed, create a hard link with:

hln [source] [destination]

2
  • Can't try it myself as my logs are on different device and I get "hln: Cross-device link" but I think this is the only same-device solution.
    – George
    May 19, 2017 at 16:56
  • You don’t want to create a hard-link to a directory. askubuntu.com/a/525129
    – Glutexo
    Mar 7, 2018 at 16:48
4

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

1
  • 1
    Any idea on how to get the log files with columns like the other OS logs?
    – Czar
    Dec 17, 2010 at 15:49
1

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/'

2
  • This didn't seem to work for me on Leopard 1.5.7, am I missing something?
    – Ted Naleid
    May 22, 2009 at 3:03
  • Sorry I thumbed it up before trying. That default doesn't exist.
    – sholsinger
    Sep 3, 2009 at 2:10
1

Since Mavericks, symlink behavior as change so "ln - s" doesn't work anymore. use hardlink-osx instead to create an hardlink to your directory (may be installed via homebrew)

1
1

Very old post I know but, this is the only way I could get it to work.

cd /Library/Logs
sudo mkdir log_files
sudo ln -s /Users/USERNAME/Sites/website/logs/* log_files
1

In mac os 10.11, you may not be able to link to folder of logs, but instead you need to link to each log of logs folder in side console.

ln -s /opt/local/apache2/logs/error_log ~/Library/Logs/Apache2/error_log
0

You can just open any text file with console.app and it will add and keep it. Folder's though, no luck on that yet.

0

I was able to hardlink the files into ~/Library/logs by running:

ln /usr/local/var/logs/postgres.log ~/Library/logs

Notice the absence of -s.

No luck for directories though. OSX Sierra 10.12.6

-1

Just tried to do something similar.

I enter this in terminal, while the Console.app was running.

sudo mkdir -p /usr/local/var/log/apache2
sudo mv /private/var/log/apache2 /usr/local/var/log/apache2/apache2-old
sudo ln -s /usr/local/var/log/apache2 /private/var/log/apache2

Now whenever I open the Console.app it crashes.

Really wish there was a way of adding log files in the files. You CAN do it by dragging and dropping a folder onto the Console.app (given it a directory path as an argument), but the added folder only displays its immediate contents and doesn't allow for recursively descending into folders.

---------EDIT BELOW----------

Nevermind I stupidly did something like this leading to infinite recursion in Console.app

sudo mkdir -p /usr/local/var/log/apache2
sudo ln -s /private/var/log/apache2/apache2 /usr/local/var/log/apache2
sudo mv /private/var/log/apache2 /usr/local/var/log/apache2/apache2-old
sudo ln -s /usr/local/var/log/apache2 /private/var/log/apache2
-4

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.

4
  • 5
    The standard locations according to Apple's Console.app don't include Homebrew's /usr/local/var/log, which I'd call pretty standard for anyone who uses the command line in OS X.
    – Carl G
    Aug 8, 2015 at 16:05
  • 1
    Homebrew is a third-party add-on, it's not part of the OS. It shouldn't be defining its own log locations, it should be using the standard locations just like everything else. Aug 8, 2015 at 17:57
  • All kinds of product use non-standard log locations, most commonly own their own application folders. Try Glassfish for instance. Jul 14, 2017 at 11:35
  • That means Console won’t pick them up. They should use a standard location if possible, so they’re picked up by Console. Jul 19, 2017 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.