Configuring your Java Logs.

Logscape supports the Log4j logging standing, if you're sending your Java logs into the cloud, then the default Log4J workspaces will give you an overview of problems in your Java application logs, including exceptions and warnings across your packages and threads.

Stream your Java logs with Log4J

In a couple of minutes it is possible to set up your log4J logs to be streamed to the Logscape Cloud, allow data visulation and analysis.

1) Configure your Log4j syslog appender

Java applications are capable of sending their log files via syslog directly to the Logscape cloud(Method 1), however the recomended method is to first forward these logs to a centralized syslog server(Method 2), below you can find configuration files for each method.

Using a Central Syslog Server (method 1)

Update your log4j properties file to send your log4j data to your central syslog server. The syslog server should already be configured to forward logs into the cloud. Follow the instrucitons on this page.

log4j.rootLogger=INFO, SYSLOG
 
log4j.appender.SYSLOG=org.apache.log4j.net.SyslogAppender
log4j.appender.SYSLOG.SyslogHost=[YOUR SYSLOG SERVER]
log4j.appender.SYSLOG.Facility=Local3
log4j.appender.SYSLOG.Header=true
log4j.appender.SYSLOG.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n


Direct into the Cloud (method 2)

Log4j logs can be sent directly into the cloud. It only supports the UDP protocol and this is not the recommended method.

log4j.rootLogger=INFO, UDP
 
log4j.appender.UDP=org.apache.log4j.net.SyslogAppender
log4j.appender.UDP.SyslogHost=collector.logscape.com:1468
log4j.appender.UDP.Facility=Local3
log4j.appender.UDP.Header=true
log4j.appender.UDP.layout=org.apache.log4j.PatternLayout				
log4j.appender.A1.layout.ConversionPattern=LOGSCAPE_TOKEN=[YOUR TOKEN HERE] LOGSCAPE_TAG=Log4j %d [%t] %-5p %c - %m%n

3) Restart your java application.

Make sure that your updated log4j properties file is the classpath and then restart your java application.

java -cp log4j.properties:log4j-1.2.17.jar myJavaClass.class
step 4) Open the Log4j Workspace

The Log4j workspace can be found here.Data should start arriving in a few minutes. This depends on the log level of your application.