Blank Pad Development

A photo of Jon

Hello There

I’m Jon, a web developer working for Hubbub to make it easier for people to buy great food from their local shops.

This is where I occassionally write about what I'm doing, and make a note of anything I'm likely to want to Google in the future!

Logging to Syslog from the command line

Whilst reading about Heroku’s logging on Adam’s blog I came across logger, a tool available on most unix systems which takes any input on STDIN, and redirects it to syslog with the provided options. I’d never heard of it, so I assume there’s some other people who havn’t either, and are doing as I have in the past and messing around with far more convaluted ways of getting output routed to syslog.

The gist of it is:

echo "This will be logged" | logger -i -p local0.notice -t EXAMPLE

Which results in the following line in /var/log/syslog on my machine:

May 10 11:25:52 imac EXAMPLE[38038]: This will be logged

See man logger for full details.

blog comments powered by Disqus