Logging Hub

Maven

If you are using Maven or another dependency management framework, you need to add the following dependency:

<dependency>
   <groupId>com.vertexlabs</groupId>
   <artifactId>vl-logging</artifactId>
   <version>1.2.0</version>
   <scope>runtime</scope> 
</dependency>

And enable the Vertex Labs repository:

<repositories>
    ...
    <repository>
        <id>Vertex Labs</id>
        <url>http://www.vertexlabs.co.uk/repository</url>
        <releases><enabled>true</enabled></releases>
        <snapshots><enabled>false</enabled></snapshots>
    </repository>    
    ...
</repositories>

Maven Central

The Logging Hub artifacts will be made available in Maven Central soon!

No dependency management?

Like to keep things simple? Download the client jar and include it in your project directly.

Updating your logging configuration

This depends on which logging framework you are using; take your pick from the options that follow. If you are using a framework that we haven't listed, please get in touch and we'll see what we can do.

Log4j (or Slf4j with the Log4j binding)

Properties file style configuration

Add the LoggingHub appender to the root logger list

# Root logger option
log4j.rootLogger=INFO, [your current appenders], loggingHub
Then define the loggingHub appender:
log4j.appender.loggingHub=com.vertexlabs.logging.log4j.SocketAppender
log4j.appender.loggingHub.host=localhost
log4j.appender.loggingHub.sourceApplication=My test application

You'll need to change the host and sourceApplication fields at some point, but we'll use these examples for now.

XML configuration

Define the Logging Hub appender
<appender name="loggingHub" class="com.vertexlabs.logging.log4j.SocketAppender"> 
    <param name="host" value="localhost"/> 
    <param name="sourceApplication" value="My test application"/> 
  </appender> 
Add the appender to the root logger
<root> 
    <priority value ="info" /> 
    <-- your existing appenders here -->
    <appender-ref ref="loggingHub" /> 
  </root>

Java.util.logging (or Slf4j with the JDK logging binding)

Properties file style configuration

You should have a logging.properties file, which you'll need to edit. Add the handler:
handlers=[your existing handlers], com.vertexlabs.logging.handlers.SocketHandler
Provider the parameters:
com.vertexlabs.logging.level = WARNING
com.vertexlabs.logging.handlers.SocketHandler.level = ALL
com.vertexlabs.logging.handlers.SocketHandler.connectionPoints=localhost
com.vertexlabs.logging.handlers.SocketHandler.applicationName=My test application

Double check

The first line stops the internal logging inside the the handler from logging to itself. If you forget that you'll get a lot of spurious log events.

All done? Time to download the hub...