Java log4j Integration

Alooma supports a log4j interface that allows you to send events directly from your Java code quickly and easily.

Step 1 - Configure the Alooma Reporter

In your log4j2.xml add the following lines:

  1. In the <Appenders></Appenders> section:

    <Socket name="Alooma" host="" port="5001" 
    <PatternLayout pattern="%m%n" />
  2. In the <Loggers></Loggers> section:

    <Logger name="alooma-reporter" level="debug" additivity="false">
      <AppenderRef ref="Alooma" />

Step 2 - Send events using the Alooma reporter

  1. Log in to your Alooma account and add an "Java App" input.

  2. Give your input a name and copy the generated token.

  3. In your application code, initialize the reporter using the token from step 2:

    private static final Logger reporter = LogManager.getLogger("alooma-reporter");

    To send an event to Alooma:



The parameter passed to the info function should be a valid JSON object, encoded as a string. It may contain any field you like, including nested fields. It is recommended that you include a field called "type" which identifies the event type.

For more details about the logger and format used see the docs for SocketAppender and JSONLayout.

Search results

    No results found