Save time managing and deploying your node.js app

Nodejitsu has joined GoDaddy

We are excited to join GoDaddy to help spearhead their largest Node.js product: Website Builder. Please read our blog post to learn more about customer transition plans and our continued support for Open Source within the node community.

Want to know all the details?
Read the full blog post or read the GoDaddy Announcement.

Logging, Logs, and Loggly in Node.js

About the author

nodejitsu nodejitsu

Other popular posts

- Scaling Isomorphic Javascript Code - Keep a node.js server up with Forever - Package.json dependencies done right
- npm cheat sheet - 6 Must Have Node.js Modules

This is Part One of a two part post on logging in node.js — I think every developer has a love/hate relationship with their log files. They love them when they have to debug, optimize or fix a problem, but they hate setting them up and later distributing, aggregating and searching log files. There are a lot of utilities out there for managing your logs, but one caught our eye at Nodejitsu: Loggly. That's why we're happy to announce the release of node-loggly: A library for interacting with the Loggly API.

Using node-loggly

There is a robust amount of documentation for node-loggly on the GitHub project page. To get started you want to install node-loggly using npm:

  npm install loggly

Here is a quick summary of basic logging with node-loggly. We'll require loggly, configure it with an account, and log some test data:

var loggly = require('loggly');  
var config = {  
  subdomain: "your-subdomain",
  auth: {
    username: "your-username",
    password: "your-password"

var client = loggly.createClient(config);

// Logging with no callback ('fire and forget')
client.log('your-really-long-input-token', ' - Theres no place like home');

// Logging with a callback
client.log('your-really-long-input-token', ' - Theres no place like home', function (err, result) {  
  // Do something once you've logged

Logging and Nodejitsu

Last month Heroku announced "Sweet Logging" which perplexed me as to how their customers functioned before this feature. I wonder how they were able to manage their own log files without such a feature. Regardless, you can be sure that given our Loggly-backed infrastructure Nodejitsu users will be able to see logs for all applications and servers with ease from the start.

What's next?

So why is this a two part post? Well we've been working on more than just the Loggly API. After taking a survey of the logging libraries available for node.js it was clear there was a missing link. Our interpretation of this missing link is a new multi-transport logging library: winston. A transport is essentially a storage device for your logs. Each instance of the winston logger can have multiple transports configured at different levels.We will be releasing winston in the next few days, so check back soon.