You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Mark Modrall <MM...@glgroup.com> on 2007/06/13 20:37:55 UTC

building nteventlogappender.dll?

Hi...

 

            We're trying to move a java program to a Windows 64-bit os
environment with the 64-bit jvm.  The latest problem we ran into was
that the nteventlogappender.dll is build 32-bit, so it's barfing.

 

            I went to see about building a 64-bit version.  First I
downloaded the 1.2.14 bin + src full distribution and found that the
package was missing several include files and had no make script.  I
went to the public svn site and did a checkout.  I found the code there
was a) different than the 1.2.14 distro and b) still missing include
files.

 

            Where is one supposed to get the missing bits to build this
piece?

 

Thanks

Mark

 
This e-mail message, and any attachments, is intended only for the use of the individual or entity identified in the alias address of this message and may contain information that is confidential, privileged and subject to legal restrictions and penalties regarding its unauthorized disclosure and use. Any unauthorized review, copying, disclosure, use or distribution is strictly prohibited. If you have received this e-mail message in error, please notify the sender immediately by reply e-mail and delete this message, and any attachments, from your system. Thank you.

Re: building nteventlogappender.dll?

Posted by Curt Arnold <ca...@apache.org>.
On Jun 26, 2007, at 8:24 AM, Mark Modrall wrote:

> We’ve cobbled together a 64-bit version of NTEventLogAppender by  
> changing the handle types to jlong in the jni glue and the cpp and  
> it seems to work okay.  I don’t know what the best/standard way to  
> make conditional compilation in the jni java;  we’ll pass along the  
> code and the visual studio project if interested.
>
>
>
> Thanks
>
> Mark
>
>

Filing a bug report and attaching the files would be the best way.

NTEventLogAppender.java uses a int member (_handle) to maintain the  
event log handle and uses an int parameter on calls to JNI methods.   
That choice is inadequate for Win64, however it is embedded in every  
previous version of log4j.  If were were to modify  
NTEventLogAppender.dll to support Win64, we need to ensure that it  
still would work with earlier versions of log4j.

To address the issue, I would suggest:

Changing _handle in NTEventLogAppender.java to long.
Duplicating the definitions of the three native methods in  
NTEventLogAppender.java but changing the handle parameter to longs.
Changing the three native methods in nteventlog.cpp to use jlong for  
the handle parameter.
Writing proxies for the obsolete native methods that cast the jint  
handle parameter up to a jlong and delegate to the modified native  
methods.
Writing a build64.xml or buildms.xml which calls rc and cl instead of  
windres and gcc.

If you can provide patches for those changes, provide a build64.xml  
or buildms.xml and confirm that it works on Win64, then it would be  
possible for others to check that it still works on Win32 and the  
NTEventLogAppender.dll also works with earlier versions of log4j.   
However, if you wanted to test the Win32 and backwards compatibility,  
that would be appreciate too.

RE: building nteventlogappender.dll?

Posted by Mark Modrall <MM...@glgroup.com>.
We've cobbled together a 64-bit version of NTEventLogAppender by
changing the handle types to jlong in the jni glue and the cpp and it
seems to work okay.  I don't know what the best/standard way to make
conditional compilation in the jni java;  we'll pass along the code and
the visual studio project if interested.

 

Thanks

Mark

 

 



 
This e-mail message, and any attachments, is intended only for the use of the individual or entity identified in the alias address of this message and may contain information that is confidential, privileged and subject to legal restrictions and penalties regarding its unauthorized disclosure and use. Any unauthorized review, copying, disclosure, use or distribution is strictly prohibited. If you have received this e-mail message in error, please notify the sender immediately by reply e-mail and delete this message, and any attachments, from your system. Thank you. 

________________________________


From: Mark Modrall [mailto:MModrall@glgroup.com] 
Sent: Thursday, June 14, 2007 10:24 AM
To: Log4J Developers List
Subject: RE: building nteventlogappender.dll?

 

Hi Curt...

 

 

This e-mail message, and any attachments, is intended only for the use
of the individual or entity identified in the alias address of this
message and may contain information that is confidential, privileged and
subject to legal restrictions and penalties regarding its unauthorized
disclosure and use. Any unauthorized review, copying, disclosure, use or
distribution is strictly prohibited. If you have received this e-mail
message in error, please notify the sender immediately by reply e-mail
and delete this message, and any attachments, from your system. Thank
you. 

________________________________

>The missing include files are likely the output of javah and are
therefore derived from the corresponding Java files and are not included
in the distribution.  

 

>If you look at src/ntdll/build.xml, the build sequence should be fairly
obvious.  The Win32 NTEventLogAppender.dll is built using MinGW to allow
the release to be built without requiring developers to have a license
of some particular version of Microsoft Visual Studio.  However, I do
not know of a free compiler for Win64.

 

            Thanks for the response.  After I posted, I'd done some more
googling around and got led to the same conclusion.  I started putting
together a Visual Studio project for it but then ran across an
interesting problem.

 

            The event log appender code is treating HANDLE as jint which
works okay on a 32 bit environment (aside from a sign issue) since the
jdk in includes\win32\jni_md.h defines jint as long.  The problem is
that the jni_md.h that comes with the windows 64-bit jvm *still* defines
jint as long, so HANDLE (a pointer) won't fit in a jint on the 64 bit
system.

 

            Seems like the easiest way to make NtEventLogAppender 64-bit
compatible is to change the log4j jni code to use jlong to hold/deal
with HANDLEs.   It wastes a few bits on the 32-bit platform but lets you
move back and forth.

 

Thanks

Mark

RE: building nteventlogappender.dll?

Posted by Mark Modrall <MM...@glgroup.com>.
Hi Curt...

 



 
This e-mail message, and any attachments, is intended only for the use of the individual or entity identified in the alias address of this message and may contain information that is confidential, privileged and subject to legal restrictions and penalties regarding its unauthorized disclosure and use. Any unauthorized review, copying, disclosure, use or distribution is strictly prohibited. If you have received this e-mail message in error, please notify the sender immediately by reply e-mail and delete this message, and any attachments, from your system. Thank you. 

________________________________


>The missing include files are likely the output of javah and are
therefore derived from the corresponding Java files and are not included
in the distribution.  

 

>If you look at src/ntdll/build.xml, the build sequence should be fairly
obvious.  The Win32 NTEventLogAppender.dll is built using MinGW to allow
the release to be built without requiring developers to have a license
of some particular version of Microsoft Visual Studio.  However, I do
not know of a free compiler for Win64.

 

            Thanks for the response.  After I posted, I'd done some more
googling around and got led to the same conclusion.  I started putting
together a Visual Studio project for it but then ran across an
interesting problem.

 

            The event log appender code is treating HANDLE as jint which
works okay on a 32 bit environment (aside from a sign issue) since the
jdk in includes\win32\jni_md.h defines jint as long.  The problem is
that the jni_md.h that comes with the windows 64-bit jvm *still* defines
jint as long, so HANDLE (a pointer) won't fit in a jint on the 64 bit
system.

 

            Seems like the easiest way to make NtEventLogAppender 64-bit
compatible is to change the log4j jni code to use jlong to hold/deal
with HANDLEs.   It wastes a few bits on the 32-bit platform but lets you
move back and forth.

 

Thanks

Mark

Re: building nteventlogappender.dll?

Posted by Curt Arnold <ca...@apache.org>.
On Jun 13, 2007, at 1:37 PM, Mark Modrall wrote:

> Hi…
>
>
>
>             We’re trying to move a java program to a Windows 64-bit  
> os environment with the 64-bit jvm.  The latest problem we ran into  
> was that the nteventlogappender.dll is build 32-bit, so it’s barfing.
>
>
>
>             I went to see about building a 64-bit version.  First I  
> downloaded the 1.2.14 bin + src full distribution and found that  
> the package was missing several include files and had no make  
> script.  I went to the public svn site and did a checkout.  I found  
> the code there was a) different than the 1.2.14 distro and b) still  
> missing include files.
>
>
>
>             Where is one supposed to get the missing bits to build  
> this piece?
>
>
>
> Thanks
>
> Mark
>
>

The missing include files are likely the output of javah and are  
therefore derived from the corresponding Java files and are not  
included in the distribution.

If you look at src/ntdll/build.xml, the build sequence should be  
fairly obvious.  The Win32 NTEventLogAppender.dll is built using  
MinGW to allow the release to be built without requiring developers  
to have a license of some particular version of Microsoft Visual  
Studio.  However, I do not know of a free compiler for Win64.