Skip to content

Zensight/natural-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What this is

Riemann is a monitoring tool that allows you to aggregate, slice, and act on a stream of events generated by your deployment environment. It's CEP for ops. Generally, you instrument your code to push events at Riemann over the wire, and if you do it right, you end up replacing logging. But what about logging from third party libraries? They're sending all of their log data to Log4j or Logback or whatever, and if you care about that stuff, you'll still need to fumble with appenders or whatever.

So what natural-log does is bridge those logging libraries to Riemann, turning all those log messages into events and pouring them into Riemann's hungry maw. Now you can monitor them just like anything else.

How to get it

##Maven

Repository:

<repository>
  <id>clojars.org</id>
  <url>http://clojars.org/repo</url>
</repository>

Dependency:

<dependency>
  <groupId>co.zensight</groupId>
  <artifactId>natural-log</artifactId>
  <version>0.1</version>
</dependency>

##Lein

[co.zensight/natural-log "0.1"]

How to use it

##Just Riemann

I suspect most people using this tool will do all their logging through Riemann and would prefer not deal with SLF4J at all. In that case, just call the convenience method:

RiemannAppender.sendEverythingToRiemann(riemannClient, "DEBUG");

##SLF4J and Logback

All this jar actually contains is a Logback appender that sends things to Riemann. If you want, you can configure it through logback.xml:

<configuration>

  <appender name="riemann" class="co.zensight.RiemannAppender">
    <riemannHost>localhost</riemannHost>
    <riemannPort>5555</riemannPort>
  </appender>

  <root level="DEBUG">
    <appender-ref ref="riemann" />
  </root>
</configuration>

##Bridging Log4j and Commons Logging

The trick here is to use SLF4J's existing ability to bridge those logging frameworks. First, exclude the legacy libraries altogether from your dependencies, for example, in Lein:

[com.amazonaws/aws-java-sdk "1.9.0" :exclusions [log4j commons-logging]]

Then include the bridge jars. For example, again in Lein:

[org.slf4j/jcl-over-slf4j "1.7.1"]
[org.slf4j/log4j-over-slf4j "1.7.1"]]

Those bridge jars just define the same packages as the original jars, and now that those jars aren't on the classpath, they'll get picked up automatically. And they send stuff to Logback. Then you just have to set up the appender as described above.

Releases

No releases published

Packages

No packages published

Languages