Author: carnold
Date: Sun Dec 11 17:05:13 2005
New Revision: 356078
URL: http://svn.apache.org/viewcvs?rev=356078&view=rev
Log:
Bug 37866: NTEventLogAppender.dll not built by Ant
Added:
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/NTEventLogAppender.rc
(with props)
logging/log4j/branches/v1_2-branch/tests/src/java/org/apache/log4j/nt/
logging/log4j/branches/v1_2-branch/tests/src/java/org/apache/log4j/nt/NTEventLogAppenderTest.java
(with props)
Removed:
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/test/
Modified:
logging/log4j/branches/v1_2-branch/build.xml
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/NTEventLogAppender.java
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/nteventlog.cpp
logging/log4j/branches/v1_2-branch/tests/build.xml
Modified: logging/log4j/branches/v1_2-branch/build.xml
URL:
http://svn.apache.org/viewcvs/logging/log4j/branches/v1_2-branch/build.xml?rev=356078&r1=356077&r2=356078&view=diff
==============================================================================
--- logging/log4j/branches/v1_2-branch/build.xml (original)
+++ logging/log4j/branches/v1_2-branch/build.xml Sun Dec 11 17:05:13 2005
@@ -104,7 +104,7 @@
These are the targets supported by this ANT build scpript:
build - compile all project files, if a certain library is missing,
- then the compilation of its dependents are skipped.
+ then the compilation of its dependents are skipped.
javadoc - build project javadoc files
@@ -151,7 +151,7 @@
<target name="jmsCheck">
<available classname="javax.jms.Message" property="jms-present">
<classpath>
- <pathelement location="${jms.jar}"/>
+ <pathelement location="${jms.jar}"/>
</classpath>
</available>
</target>
@@ -169,7 +169,7 @@
<target name="javamailCheck">
<available classname="javax.mail.Message" property="javamail-present">
<classpath>
- <pathelement location="${javamail.jar}"/>
+ <pathelement location="${javamail.jar}"/>
</classpath>
</available>
</target>
@@ -312,6 +312,48 @@
</javac>
</target>
+ <target name="build.nt" depends="log4j.jar" description="Build
NTEventLogAppender.dll">
+ <javah
class="org.apache.log4j.nt.NTEventLogAppender,org.apache.log4j.Priority"
+ destdir="${javac.dest}"
+ classpath="${jar.dest}/${jar.filename}"/>
+ <exec executable="mc">
+ <arg value="-h"/>
+ <arg file="${javac.dest}"/>
+ <arg value="-r"/>
+ <arg file="${javac.dest}"/>
+ <arg file="${java.source.dir}org/apache/log4j/nt/EventLogCategories.mc"/>
+ </exec>
+
+ <exec executable="windres">
+ <arg value="-o"/>
+ <arg file="${javac.dest}/EventLogCategories.o"/>
+ <arg value="--include-dir=${javac.dest}"/>
+ <arg file="${javac.dest}/EventLogCategories.rc"/>
+ </exec>
+
+ <exec executable="windres">
+ <arg value="-o"/>
+ <arg file="${javac.dest}/NTEventLogAppender.o"/>
+ <arg file="${java.source.dir}org/apache/log4j/nt/NTEventLogAppender.rc"/>
+ </exec>
+
+ <property name="jni.include.dir" location="${java.home}\..\include"/>
+ <exec executable="gcc">
+ <arg value="-Wall"/>
+ <arg value="-D_JNI_IMPLEMENTATION_"/>
+ <arg value="-Wl,--kill-at"/>
+ <arg value="-I${jni.include.dir}"/>
+ <arg value="-I${jni.include.dir}\win32"/>
+ <arg value="-I${javac.dest}"/>
+ <arg value="-shared"/>
+ <arg file="${java.source.dir}org/apache/log4j/nt/nteventlog.cpp"/>
+ <arg file="${javac.dest}/NTEventLogAppender.o"/>
+ <arg file="${javac.dest}/EventLogCategories.o"/>
+ <arg value="-o"/>
+ <arg file="${jar.dest}/NTEventLogAppender.dll"/>
+ </exec>
+
+ </target>
<!-- ================================================================= -->
<!-- Remove all generated (compiled) class files. -->
@@ -369,7 +411,7 @@
<target name="log4j.jar" depends="prejar">
<delete>
<fileset dir="${jar.dest}">
- <include name="*.jar"/>
+ <include name="*.jar"/>
</fileset>
</delete>
@@ -525,38 +567,27 @@
<!-- ================================================================= -->
<!-- Build a complete distribution. Results go to ${dist.images} -->
<!-- ================================================================= -->
- <target name="dist" depends="init, clean, javadoc, jar, site">
+ <target name="dist" depends="init, clean, javadoc, jar, site, build.nt">
<delete verbose="true">
<fileset dir=".">
<patternset>
- <include name="**/*.bak"/>
- <include name="${dist.dir}/velocity.log"/>
- <include name="${BSTEM}/**/temp*"/>
- <include name="${BSTEM}/performance/test"/>
- <include name="${BSTEM}/test/current.*"/>
- <include name="${BSTEM}/test/current.*"/>
- <include name="${BSTEM}/examples/test"/>
- <include name="${BSTEM}/test/logging.*"/>
- <include name="${BSTEM}/test/log4j.properties"/>
- <include name="{$BSTEM}/test/socket.lcf"/>
- <include name="${BSTEM}/test/file"/>
- <include name="${BSTEM}/test/output.*"/>
- <include name="${BSTEM}/nt/EventLogCategories.dbg"/>
- <include name="${BSTEM}/nt/*.h"/>
- <include name="${BSTEM}/nt/*.obj"/>
- <include name="${BSTEM}/nt/*.idb"/>
- <include name="${BSTEM}/nt/EventLogCategories.rc"/>
- <include name="${BSTEM}/nt/EventLogCategories.RES"/>
- <include name="${BSTEM}/nt/EventLogCategories.res"/>
- <include name="${BSTEM}/nt/MSG00001.bin"/>
- <include name="${BSTEM}/nt/NTEventLogAppender.lib"/>
- <include name="${BSTEM}/nt/NTEventLogAppender.exp"/>
- <include name="${BSTEM}/nt/vc50.idb"/>
- <include name="${BSTEM}/net/test/loop.log"/>
- <include name="${BSTEM}/net/test/loop.log.1"/>
- <include name="${jar.dest}/manifest.mf"/>
- <include name="${javac.dest}/*.class"/>
+ <include name="**/*.bak"/>
+ <include name="${dist.dir}/velocity.log"/>
+ <include name="${BSTEM}/**/temp*"/>
+ <include name="${BSTEM}/performance/test"/>
+ <include name="${BSTEM}/test/current.*"/>
+ <include name="${BSTEM}/test/current.*"/>
+ <include name="${BSTEM}/examples/test"/>
+ <include name="${BSTEM}/test/logging.*"/>
+ <include name="${BSTEM}/test/log4j.properties"/>
+ <include name="{$BSTEM}/test/socket.lcf"/>
+ <include name="${BSTEM}/test/file"/>
+ <include name="${BSTEM}/test/output.*"/>
+ <include name="${BSTEM}/net/test/loop.log"/>
+ <include name="${BSTEM}/net/test/loop.log.1"/>
+ <include name="${jar.dest}/manifest.mf"/>
+ <include name="${javac.dest}/*.class"/>
</patternset>
</fileset>
</delete>
@@ -568,24 +599,26 @@
<copy todir="${dist.tmp}/logging-log4j-${version}">
<fileset dir="${base}"
includes="src/java/**,
- docs/**,
- examples/**,
- build/*,
- build.xml,
- build.properties.sample,
+ docs/**,
+ examples/**,
+ build/*,
+ build.xml,
+ build.properties.sample,
manifest.mf,
- INSTALL,
- LICENSE.txt,
- ${dist.dir}/lib/log4j*.jar,
- ${dist.dir}/classes/**,
- contribs/**"
+ INSTALL,
+ LICENSE.txt,
+ ${dist.dir}/lib/log4j*.jar,
+ ${dist.dir}/lib/NTEventLogAppender.dll,
+ ${dist.dir}/classes/**,
+ contribs/**"
excludes="make/make.loc,
- **/*.bak, **/goEnv.bat,
- **/Makefile, **/goEnv.bat,
- docs/pub-support/*,
- ${dist.dir}/classes/org/**,
- src/java/org/apache/log4j/test/**/*,
- **/.#*"/>
+ **/*.bak, **/goEnv.bat,
+ **/Makefile, **/goEnv.bat,
+ docs/pub-support/*,
+ ${dist.dir}/classes/org/**,
+ src/java/org/apache/log4j/test/**/*,
+ **/.#*,
+ **/*.o, **/*.res, **/*.bin, **/*.h, **/EventLogCategories.rc"/>
</copy>
@@ -596,12 +629,10 @@
<chmod dir="${dist.tmp}/logging-log4j-${version}"
includes="build.sh" perm="+x"/>
- <tar tarfile="${dist.images}/logging-log4j-${version}.tar"
+ <tar tarfile="${dist.images}/logging-log4j-${version}.tar.gz"
basedir="${dist.tmp}"
- includes="logging-log4j-${version}/**" />
-
- <gzip src="${dist.images}/logging-log4j-${version}.tar"
- zipfile="${dist.images}/logging-log4j-${version}.tar.gz" />
+ includes="logging-log4j-${version}/**"
+ compression="gzip" />
<zip zipfile="${dist.images}/logging-log4j-${version}.zip"
basedir="${dist.tmp}"
@@ -643,5 +674,14 @@
<fail unless="javamail-found" message="JAVAMAIL was not found."/>
</target>
+
+<target name="fixcrlf" depends="init"
+ description="Fixes CR-LF and tabs in source files">
+ <fixcrlf srcDir="."
+ includes="**/*.java **/build.xml"
+ tab="remove"
+ tablength="3"/>
+</target>
+
</project>
Modified:
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/NTEventLogAppender.java
URL:
http://svn.apache.org/viewcvs/logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/NTEventLogAppender.java?rev=356078&r1=356077&r2=356078&view=diff
==============================================================================
---
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/NTEventLogAppender.java
(original)
+++
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/NTEventLogAppender.java
Sun Dec 11 17:05:13 2005
@@ -95,10 +95,10 @@
void activateOptions() {
if (source != null) {
try {
- _handle = registerEventSource(server, source);
+ _handle = registerEventSource(server, source);
} catch (Exception e) {
- LogLog.error("Could not register event source.", e);
- _handle = 0;
+ LogLog.error("Could not register event source.", e);
+ _handle = 0;
}
}
}
@@ -112,10 +112,10 @@
if(layout.ignoresThrowable()) {
String[] s = event.getThrowableStrRep();
if (s != null) {
- int len = s.length;
- for(int i = 0; i < len; i++) {
- sbuf.append(s[i]);
- }
+ int len = s.length;
+ for(int i = 0; i < len; i++) {
+ sbuf.append(s[i]);
+ }
}
}
// Normalize the log message level into the supported categories
Added:
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/NTEventLogAppender.rc
URL:
http://svn.apache.org/viewcvs/logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/NTEventLogAppender.rc?rev=356078&view=auto
==============================================================================
---
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/NTEventLogAppender.rc
(added)
+++
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/NTEventLogAppender.rc
Sun Dec 11 17:05:13 2005
@@ -0,0 +1,102 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "windows.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+//#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1, 2, 14, 1
+ PRODUCTVERSION 1, 2, 14, 1
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Apache Software Foundation"
+ VALUE "FileDescription", "Platform methods for NTEventLogAppender"
+ VALUE "FileVersion", "1, 2, 14, 1"
+ VALUE "InternalName", "NTEventLogAppender"
+ VALUE "LegalCopyright", "Copyright (C) 2005, Apache Software
Foundation"
+ VALUE "OriginalFilename", "NTEventLogAppender.dll"
+ VALUE "ProductName", "log4j"
+ VALUE "ProductVersion", "1, 2, 14, 1"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
Propchange:
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/NTEventLogAppender.rc
------------------------------------------------------------------------------
svn:executable = *
Modified:
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/nteventlog.cpp
URL:
http://svn.apache.org/viewcvs/logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/nteventlog.cpp?rev=356078&r1=356077&r2=356078&view=diff
==============================================================================
---
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/nteventlog.cpp
(original)
+++
logging/log4j/branches/v1_2-branch/src/java/org/apache/log4j/nt/nteventlog.cpp
Sun Dec 11 17:05:13 2005
@@ -16,6 +16,11 @@
#ifndef NtEventLogAppender_h
#define NtEventLogAppender_h
+
+#ifdef __GNUC__
+typedef long long __int64;
+#endif
+
#include "org_apache_log4j_Priority.h"
#include "org_apache_log4j_nt_NTEventLogAppender.h"
#include <windows.h>
Modified: logging/log4j/branches/v1_2-branch/tests/build.xml
URL:
http://svn.apache.org/viewcvs/logging/log4j/branches/v1_2-branch/tests/build.xml?rev=356078&r1=356077&r2=356078&view=diff
==============================================================================
--- logging/log4j/branches/v1_2-branch/tests/build.xml (original)
+++ logging/log4j/branches/v1_2-branch/tests/build.xml Sun Dec 11 17:05:13 2005
@@ -20,6 +20,7 @@
<!-- The directory where source files are stored. -->
<property name="project.source.home" value="../src/java/"/>
<property name="project.classes.home" value="../dist/classes/"/>
+ <property name="project.lib.home" value="../dist/lib/"/>
<property name="tests.source.home" value="./src/java/"/>
<property name="excludes" value=""/>
@@ -58,7 +59,7 @@
These are the targets supported by this ANT build scpript:
build - compile all project files, if a certain library is missing,
- then the compilation of its dependents are skipped.
+ then the compilation of its dependents are skipped.
regression - Run regression tests which check large parts of log4j.
@@ -72,6 +73,9 @@
<target name="prepare">
<mkdir dir="./classes" />
<mkdir dir="./output" />
+ <condition property="is-windows" value="true">
+ <os family="windows"/>
+ </condition>
</target>
<!-- Clean the parent project -->
@@ -97,12 +101,12 @@
<target name="build" depends="parentBuild, prepare">
<property name="haltonfailure" value="yes"/>
<javac srcdir="${tests.source.home}"
- destdir="./classes"
+ destdir="./classes"
deprecation="${deprecation}"
target="${javac.target}"
source="${javac.source}"
debug="on"
- excludes="${excludes}">
+ excludes="${excludes}">
<classpath refid="tests.classpath"/>
</javac>
</target>
@@ -133,7 +137,7 @@
OptionConverter, BoundedFIFO,
CyclicBuffer, OR,
LevelMatchFilter, PatternParser,
- PatternLayout, DRFA"/>
+ PatternLayout, DRFA, NTEventLogAppender"/>
<!-- ================================================================= -->
<!-- Longer unit tests -->
@@ -262,18 +266,18 @@
<target name="SocketServer" depends="build">
<parallel>
<java classname="org.apache.log4j.net.ShortSocketServer" fork="yes">
- <arg value="8"/>
- <arg value="input/socketServer"/>
- <classpath refid="tests.classpath"/>
+ <arg value="8"/>
+ <arg value="input/socketServer"/>
+ <classpath refid="tests.classpath"/>
</java>
<sequential>
- <sleep seconds="2"/>
- <junit printsummary="yes" fork="yes" haltonfailure="${haltonfailure}">
- <sysproperty key="testNumber" value="1"/>
- <classpath refid="tests.classpath"/>
- <formatter type="plain" usefile="false" />
- <test name="org.apache.log4j.net.SocketServerTestCase" />
- </junit>
+ <sleep seconds="2"/>
+ <junit printsummary="yes" fork="yes" haltonfailure="${haltonfailure}">
+ <sysproperty key="testNumber" value="1"/>
+ <classpath refid="tests.classpath"/>
+ <formatter type="plain" usefile="false" />
+ <test name="org.apache.log4j.net.SocketServerTestCase" />
+ </junit>
</sequential>
</parallel>
</target>
@@ -356,6 +360,17 @@
<classpath refid="tests.classpath"/>
<formatter type="plain" usefile="false"/>
<test name="org.apache.log4j.DRFATestCase" />
+ </junit>
+ </target>
+
+ <target name="NTEventLogAppender" depends="build" if="is-windows">
+ <junit printsummary="yes"
+ fork="yes"
+ haltonfailure="${haltonfailure}"
+ dir="${project.lib.home}">
+ <classpath refid="tests.classpath"/>
+ <formatter type="plain" usefile="false"/>
+ <test name="org.apache.log4j.nt.NTEventLogAppenderTest" />
</junit>
</target>
Added:
logging/log4j/branches/v1_2-branch/tests/src/java/org/apache/log4j/nt/NTEventLogAppenderTest.java
URL:
http://svn.apache.org/viewcvs/logging/log4j/branches/v1_2-branch/tests/src/java/org/apache/log4j/nt/NTEventLogAppenderTest.java?rev=356078&view=auto
==============================================================================
---
logging/log4j/branches/v1_2-branch/tests/src/java/org/apache/log4j/nt/NTEventLogAppenderTest.java
(added)
+++
logging/log4j/branches/v1_2-branch/tests/src/java/org/apache/log4j/nt/NTEventLogAppenderTest.java
Sun Dec 11 17:05:13 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright 1999,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.log4j.nt;
+import junit.framework.TestCase;
+import org.apache.log4j.Logger;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Level;
+import org.apache.log4j.BasicConfigurator;
+
+
+/**
+ *
+ * NTEventLogAppender tests.
+ *
+ * @author Curt Arnold
+ */
+public class NTEventLogAppenderTest extends TestCase {
+
+ /**
+ * Clean up configuration after each test.
+ */
+ public void tearDown() {
+ LogManager.shutdown();
+ }
+
+ /**
+ * Simple test of NTEventLogAppender.
+ */
+ public void testSimple() {
+ BasicConfigurator.configure(new NTEventLogAppender());
+ Logger logger =
Logger.getLogger("org.apache.log4j.nt.NTEventLogAppenderTest");
+ int i = 0;
+ logger.debug( "Message " + i++);
+ logger.info( "Message " + i++);
+ logger.warn( "Message " + i++);
+ logger.error( "Message " + i++);
+ logger.log(Level.FATAL, "Message " + i++);
+ logger.debug("Message " + i++, new Exception("Just testing."));
+ }
+}
Propchange:
logging/log4j/branches/v1_2-branch/tests/src/java/org/apache/log4j/nt/NTEventLogAppenderTest.java
------------------------------------------------------------------------------
svn:executable = *
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]