BizTalk-Log4net 64bit issues

Aug 18, 2009 at 4:53 PM

Hi Tom,

I need some help/clarification, in both the .targets and nant script files there are the following lines -

Write registry key with location of our log4net configuration file.

 --> Note: If you're doing 32 bit hosts on win64, hard code this to cscript.exe rather than using macro. -->Exec

Command=""$(Cscript)" /nologo "$(DeployTools)\WriteRegValue.vbs" $(Log4netRegKey) "@(Log4netFile)""

Condition="'$(Includelog4net)' == 'true'" />

Why do we need to do this, reason for asking having few issues with Log4net and the registry entries on a 64bit BizTalk box.

There appears to be two registries one can be run using %systemroot%\syswow64\regedit at the command prompt the other the usual regedit command.

BDF adds the log4net reg entries as usual and I viewed them using regedit the log4netconfig key points to c:\Program Files (x86)\.... which appears to be correct.

When you then run a message through BizTalk you get the following exception in the event viewer -

Log4netConfigHelper: Unable to read registry key for log4net configuration location.

After a lot of scratching of heads a colleague pointed me in the direction of the %systemroot%\syswow64\regedit, I then manually added the same reg entries into the registry via %systemroot%\syswow64\regedit and the message was processed correctly by BizTalk, but no log4net output through Debugview, very confused.

Hope the above makes sense.

Any help would be grateful.

Cheers

Jim

Coordinator
Aug 19, 2009 at 5:32 AM
Hello Jim -

The issue is that when you run 32 bit hosts on Win64, you will wind up using the "32 bit registry" - the portion of the registry that gets redirected for 32 bit windows apps on Win64. 

The $(Cscript) macro is supposed to use the "right" version of cscript.exe such that WriteRegValue will write to the correct registry ....it does this by using cscript.exe for 32 bit case, and a copy of the 64-bit version of cscript.exe (renamed cscript64.exe) to force 64 bit even though, from a 32 bit nant process, you would normally get the 32 bit copy of cscript.exe.

But of course, this whole mechanism doesn't accommodate the mix of 32 bit hosts on Win64.

Since nant runs as 32 bit, the hack is to simply call out "cscript.exe" which will get you 32 bit registry entries out of WriteRegValue.vbs.

You should indeed be getting log4net output once you have this right.  Sorry this part of things is such a mess at the moment.


On Tue, Aug 18, 2009 at 11:53 AM, jmclay <notifications@codeplex.com> wrote:

From: jmclay

Hi Tom,

I need some help/clarification, in both the .targets and nant script files there are the following lines -

Write registry key with location of our log4net configuration file.

 --> Note: If you're doing 32 bit hosts on win64, hard code this to cscript.exe rather than using macro. -->Exec

Command=""$(Cscript)" /nologo "$(DeployTools)\WriteRegValue.vbs" $(Log4netRegKey) "@(Log4netFile)""

Condition="'$(Includelog4net)' == 'true'" />

Why do we need to do this, reason for asking having few issues with Log4net and the registry entries on a 64bit BizTalk box.

There appears to be two registries one can be run using %systemroot%\syswow64\regedit at the command prompt the other the usual regedit command.

BDF adds the log4net reg entries as usual and I viewed them using regedit the log4netconfig key points to c:\Program Files (x86)\.... which appears to be correct.

When you then run a message through BizTalk you get the following exception in the event viewer -

Log4netConfigHelper: Unable to read registry key for log4net configuration location.

After a lot of scratching of heads a colleague pointed me in the direction of the %systemroot%\syswow64\regedit, I then manually added the same reg entries into the registry via %systemroot%\syswow64\regedit and the message was processed correctly by BizTalk, but no log4net output through Debugview, very confused.

Hope the above makes sense.

Any help would be grateful.

Cheers

Jim

Read the full discussion online.

To add a post to this discussion, reply to this email (biztalkdeployment@discussions.codeplex.com)

To start a new discussion for this project, email biztalkdeployment@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com




--
scott colestock
612.559.0580
Coordinator
Aug 19, 2009 at 3:40 PM

Hi Jim, it sounds to me like the best solution here is to automatically run both the 32-bit and 64-bit cscript commands on x64 OS's, effectively creating the registry keys in both views of the registry.  I created an Issue Tracker item for this.

Thanks,
Tom