Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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.

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]

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

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

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)

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

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. Under ~/Library/Logs/Apache2 directory ln -s /opt/loacal/apache2/logs/error_log error_log

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.

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

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top