oohlalog-4j

Provides a log4j appender to send logs to the cloud via the oohlalog cloud logging service.

License

License

The Apache Software License, Version 2.0
GroupId

GroupId

com.oohlalog
ArtifactId

ArtifactId

oohlalog-4j
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

oohlalog-4j
Provides a log4j appender to send logs to the cloud via the oohlalog cloud logging service.
Project URL

Project URL

http://www.oohlalog.com
Source Code Management

Source Code Management

https://github.com/oohlalog/oohlalog_log4j

Download oohlalog-4j

How to add to project

<!-- https://jarcasting.com/artifacts/com.oohlalog/oohlalog-4j/ -->
<dependency>
    <groupId>com.oohlalog</groupId>
    <artifactId>oohlalog-4j</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.oohlalog/oohlalog-4j/
implementation 'com.oohlalog:oohlalog-4j:1.0.2'
// https://jarcasting.com/artifacts/com.oohlalog/oohlalog-4j/
implementation ("com.oohlalog:oohlalog-4j:1.0.2")
'com.oohlalog:oohlalog-4j:jar:1.0.2'
<dependency org="com.oohlalog" name="oohlalog-4j" rev="1.0.2">
  <artifact name="oohlalog-4j" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.oohlalog', module='oohlalog-4j', version='1.0.2')
)
libraryDependencies += "com.oohlalog" % "oohlalog-4j" % "1.0.2"
[com.oohlalog/oohlalog-4j "1.0.2"]

Dependencies

runtime (2)

Group / Artifact Type Version
log4j : log4j jar 1.2.17
com.google.code.gson : gson jar 2.2.4

Project Modules

There are no modules declared in this project.

OohLaLog Log4j Appender

Log 4j Appender for Oohlalog Cloud Logging Service will post log messages the OohLaLog using standard Log4J interfaces and configuration.

##Configuration

Please follow standard Log4J properties-based or XML-based configuration and include the following properties.

log4j.appender.oohlalog=com.oohlalog.log4j.OohLaLogAppender
log4j.appender.oohlalog.layout=org.apache.log4j.PatternLayout
log4j.appender.oohlalog.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

#Required: Replace with OohLaLog instance Api Key
log4j.appender.oohlalog.AuthToken=1234 

#Optional: number logs to buffer before posting to OLL (lower numbers impact app performance)
#log4j.appender.oohlalog.MaxBuffer=100 

#Optional: age of logs in buffer before automatic posting to OLL (lower numbers impact app performance)
#log4j.appender.oohlalog.TimeBuffer=5000

Replace AuthToken with the Api Key for your OohLaLog instance.

##Logging Context You may use the Logging Event NDC or the Logging Event MDCto set the logging context. This will set the OohLaLog log token that can be used to correllate log entries. For Example, you set the NDC to the remote user making an HTTP request.

org.apache.log4j.NDC.push(javax.servlet.http.HttpServletRequest.getRemoteUser()); 

or

org.apache.log4j.MDC.put("token",javax.servlet.http.HttpServletRequest.getRemoteUser()); // you must use the MDC key "token"

##Dependencies

To use the OohLaLog Log4J Appender please include the following jars in your classpath:

###1. OohLaLog Jar

oohlalog-4j-0.2.3.jar 

Repository Info:

http://nexus.bertramlabs.com/content/repositories/publicReleases/

Maven info:

<dependency>
  <groupId>oohlalog</groupId>
  <artifactId>oohlalog-4j</artifactId>
  <version>0.2.3</version>
</dependency>

2. GSON Jar

gson-2.2.4.jar

Repository Info:

Maven Central

Maven info:

<dependency>
  <groupId>com.google.code.gson</groupId>
  <artifactId>gson</artifactId>
  <version>2.2.4</version>
</dependency>

##Counters

The OohLaLog log4j adapter also implements a new log level called "COUNT". This level can be used to create manual counters for the configured OohLaLog instance.

import com.oohlalog.log4j.CountLevel;

...

Logger logger = Logger.getLogger(MyClass.class.getName());
		 
logger.log(CountLevel.COUNT,"My Custom Counter"); // Message will become the name of the counter

The counter will appear on your OohLaLog dashboard.

com.oohlalog

Oohlalog

Versions

Version
1.0.2