This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
forked from apache/logging-log4j1
-
Notifications
You must be signed in to change notification settings - Fork 2
/
INSTALL
105 lines (74 loc) · 2.83 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
===========
Using log4j
===========
1) First untar or unzip the distribution file.
2) Assuming you chose to extract the distribution in to the
PATH_OF_YOUR_CHOICE, untarring the distribution file should create
a logging-log4j-VERSION directory, where VERSION is the log4j
version number, under PATH_OF_YOUR_CHOICE. We will refer to the
directory PATH_OF_YOUR_CHOICE/apache-log4j-VERSION/ as $LOG4J_HOME/.
3) Add $LOG4J_HOME/log4j-VERSION.jar to your CLASSPATH,
4) You can now test your installation by first compiling the following
simple program.
import org.apache.log4j.Logger;
import org.apache.log4j.BasicConfigurator;
public class Hello {
private static final Logger logger = Logger.getLogger(Hello.class);
public
static
void main(String argv[]) {
BasicConfigurator.configure();
logger.debug("Hello world.");
logger.info("What a beatiful day.");
}
}
After compilation, try it out by issuing the command
java Hello
You should see log statements appearing on the console.
5) Refer to the javadoc documentation and the user manual on how to
include log statements in your own code.
=========
JAR files
=========
The log4j distribution comes with one jar file: log4j-VERSION.jar
under the LOG4J_HOME directory.
This jar file contains all the class files of the log4j project,
except test cases and classes from the "examples" and
"org.apache.log4j.performance" packages.
==============
Building log4j
==============
log4j (as of 1.2.18) is built with Maven 3 and JDK 8 or higher.
To build for compatibility with older JDKs (1.4/5/7), set up a Maven
toolchain JDK with version=1.6 and vendor=oracle. For example set up
the following configuration in ~/.m2/toolchains.xml:
<?xml version="1.0" encoding="UTF-8"?>
<toolchains>
<toolchain>
<type>jdk</type>
<provides>
<version>1.6</version>
<vendor>oracle</vendor>
</provides>
<configuration>
<jdkHome>/usr/lib/jvm/java-1.6.0-openjdk-amd64</jdkHome>
<!-- <jdkHome>C:\Program Files\Java\jdk1.6.0_45</jdkHome> -->
</configuration>
</toolchain>
</toolchains>
See https://maven.apache.org/guides/mini/guide-using-toolchains.html
for more information about maven toolchains.
After setting up a toolchain you can then build using the default
profile:
mvn verify
If you do not care about compatibility with old JDKs, you can use a
build without a toolchain and execute
mvn verify -P no-toolchain
Build results can be found in the target/ subdirectory.
==================
NTEventLogAppender
==================
The maven build uses prebuilt NTEventLogAppender.dll and
NTEventLogAppender.amd64.dll binaries. To rebuild these, see
src/ntdll
for more information.