Browse files

Build file

  • Loading branch information...
1 parent c45c73f commit f6644d297fdcb02121e4200769c28665d3a9ae2d @vilda vilda committed May 21, 2012
Showing with 56 additions and 16 deletions.
  1. +12 −13 README.md
  2. +7 −0 build.properties
  3. +31 −0 build.xml
  4. +6 −3 src/com/logentries/log4j/LeAppender.java
View
25 README.md
@@ -1,12 +1,12 @@
-Logging To Logentries from Java Platform
-==========================================================
+Logging To Logentries from Java
+==============================
Logentries currently supports log4j logging from Java as well as PaaS, such as CloudBees
--------------------------------------------------------------
Simple Usage Example
---------------------------------------------------------------
+--------------------
public class HelloLoggingWorld {
@@ -29,33 +29,32 @@ To configure log4j, you will need to perform the following:
You can obtain your Logentries account key on the Logentries UI, by clicking account in the top left cornercand then display account key on the right.
+
log4j Setup
-----------
If you don't already have log4j set up in your project, please follow these steps:
Download log4j from:
-http://www.apache.org/dyn/closer.cgi/logging/log4j/1.2.16/apache-log4j-1.2.16.zip
+https://logging.apache.org/log4j/1.2/download.html
-Retreive log4j.jar and place it the bin folder of your project.
+Retrieve log4j jar file and place it the bin folder of your project.
-Then add a reference to this jar from within your project. This is done simply by right-clicking References, Click Add Reference and locate the jar in your project bin folder.
+Then add a reference to this jar from within your project.
Logentries log4j Plugin Setup
-----------------------------
-The first file you need is logentries.jar which is the plugin for log4j. It is available from github at:
+The first file you need is logentries-VERSION.jar which is the plugin for log4j. It is available from github at:
https://github.com/logentries/le_java/downloads
-Place this in the bin folder of your project and add it as a reference as done above with log4j.jar.
-
-The second file required is called log4j.xml and is available on github at:
+Place this in the libs folder of your project and add it as a reference as done above with log4j jar.
-https://github.com/logentries/le_java/raw/master/log4j.xml
+The second file required is called log4j.xml and is available again on github on projects pages.
-Add this file to your project as it is the config which adds the plugin for log4j to send logs to Logentries.
+Add this file to your project as it is the config which adds the plugin for log4j to send logs to Logentries. This file needs to be in class path.
In this file, you will see the following:
@@ -86,7 +85,7 @@ For debugging purposes set the debug parameter to true. The appender will displa
CloudBees
-========================================
+=========
To use this plugin on CloudBees, please follow all the above instructions but be sure to place both
View
7 build.properties
@@ -0,0 +1,7 @@
+version = 1.1.3
+build.dir = bin/
+dest.dir = build/
+bin.includes = bin/
+src.includes = src/
+libs.dir = libs/
+log4j = ${libs.dir}/log4j-1.2.16.jar
View
31 build.xml
@@ -0,0 +1,31 @@
+<project name="leappender" basedir="." default="jar">
+
+ <property file="build.properties"/>
+
+ <target name="clean">
+ <delete dir="${dest.dir}"/>
+ <delete dir="${build.dir}"/>
+ </target>
+
+ <target name="init" depends="clean">
+ <delete dir="${dest.dir}"/>
+ <delete dir="${build.dir}"/>
+ <mkdir dir="${dest.dir}"/>
+ <mkdir dir="${build.dir}"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <!-- Compile the java code -->
+ <javac srcdir="src" destdir="${build.dir}" includeantruntime="false">
+ <classpath>
+ <pathelement location="${log4j}"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <!-- Build the jar file -->
+ <jar basedir="${build.dir}" destfile="${dest.dir}/leappender-${version}.jar"/>
+ </target>
+
+</project>
View
9 src/com/logentries/log4j/LeAppender.java
@@ -24,9 +24,6 @@
/*
* Constants
*/
-
- /** Version of the Logentries appender. */
- static final String VERSION = "1.1.3";
/** Size of the internal event queue. */
static final int QUEUE_SIZE = 32768;
@@ -50,6 +47,8 @@
static final int MAX_DELAY = 10000;
/** LE appender signature - used for debugging messages. */
static final String LE = "LE ";
+ /** Error message displayed when wrong configuration has been detected. */
+ static final String WRONG_CONFIG = "\n\nIt appears you forgot to customize your log4j.xml file!\n\n";
/*
* Fields
@@ -263,7 +262,11 @@ boolean checkCredentials() {
*/
public void setKey( String key) {
this.key = key;
+
dbg( "Setting account key to " + key);
+ if (key.equals( "LOGENTRIES_ACCOUNT_KEY")) {
+ System.err.println( WRONG_CONFIG);
+ }
}
/**

0 comments on commit f6644d2

Please sign in to comment.