<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v = 
"urn:schemas-microsoft-com:vml" xmlns:o = 
"urn:schemas-microsoft-com:office:office" xmlns:w = 
"urn:schemas-microsoft-com:office:word" xmlns:st1 = 
"urn:schemas-microsoft-com:office:smarttags"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2722" name=GENERATOR><!--[if !mso]>
<STYLE>v\:* {
        BEHAVIOR: url(#default#VML)
}
o\:* {
        BEHAVIOR: url(#default#VML)
}
w\:* {
        BEHAVIOR: url(#default#VML)
}
.shape {
        BEHAVIOR: url(#default#VML)
}
</STYLE>
<![endif]--><o:SmartTagType 
downloadurl="http://www.5iantlavalampft-com:office:smarttags" name="Street" 
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><o:SmartTagType 
downloadurl="http://www.5iamas-microsoft-com:office:smarttags" name="City" 
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><o:SmartTagType 
downloadurl="http://www.5iamas-microsoft-com:office:smarttags" name="address" 
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><o:SmartTagType 
downloadurl="http://www.5iantlavalamp.com/" name="country-region" 
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><o:SmartTagType 
downloadurl="http://www.5iantlavalamp.com/" name="place" 
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><!--[if !mso]>
<STYLE>st1\:* {
        BEHAVIOR: url(#default#ieooui)
}
</STYLE>
<![endif]-->
<STYLE>@font-face {
        font-family: Wingdings;
}
@font-face {
        font-family: Tahoma;
}
@page Section1 {size: 612.0pt 792.0pt; margin: 72.0pt 90.0pt 72.0pt 90.0pt; }
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.EmailStyle17 {
        COLOR: navy; FONT-FAMILY: Arial; mso-style-type: personal-reply
}
DIV.Section1 {
        page: Section1
}
OL {
        MARGIN-BOTTOM: 0cm
}
UL {
        MARGIN-BOTTOM: 0cm
}
</STYLE>
</HEAD>
<BODY lang=EN-US vLink=blue link=blue>
<DIV dir=ltr align=left><SPAN class=824443622-01092005><FONT face=Arial 
color=#0000ff size=2>I had considered logging before but decided not to because 
the volume would be severly large, but as you&nbsp;suggest, I can tweak the 
logging to just record intersting stuff.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=824443622-01092005></SPAN><SPAN 
class=824443622-01092005><FONT face=Arial color=#0000ff size=2>Another problem I 
had was that the the logging has to be thread-safe&nbsp;and non&nbsp;blocking. 
</FONT></SPAN><SPAN class=824443622-01092005><FONT face=Arial color=#0000ff 
size=2>Any tips there?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=824443622-01092005><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=824443622-01092005><FONT face=Arial 
color=#0000ff size=2>Stacey</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=824443622-01092005><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left>
<HR tabIndex=-1>
</DIV>
<DIV dir=ltr align=left><FONT face=Tahoma size=2><B>From:</B> 
delphi-bounces@ns3.123.co.nz [mailto:delphi-bounces@ns3.123.co.nz] <B>On Behalf 
Of </B>Dave Jollie<BR><B>Sent:</B> Friday, 2 September 2005 10:24<BR><B>To:</B> 
NZ Borland Developers Group - Delphi List<BR><B>Subject:</B> RE: [DUG] 
DataSnap/Midas App Server Error<BR></FONT><BR></DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV></DIV>
  <DIV class=Section1>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">You could create a 
  logging class. In each important procedure on the server&#8217;s RDM, create a 
  logging instance at the beginning of the procedure. Wrap the procedure in a 
  try finally, freeing the logging object at the end of the procedure. Within 
  the try..finally, have a try&#8230;except, catching any exception and feeding it to 
  the logging object. The logging object records to file, the start and end 
  times of the procedure, any exceptions, etc. In this way you&#8217;ll find 
  procedures that are bottlenecks, procedures that throw exceptions, and any 
  that never return, for whatever reason.<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">To reduce the volume 
  of your log file, on freeing of the logging object, you could do some tests &#8211; 
  if no exceptions were recorded in the procedure and it didn&#8217;t take too long to 
  execute, then don&#8217;t write any info to file &#8211; only write to file for exceptions 
  or very long times. However, then you&#8217;d miss any procedure which never 
  returns. For this you&#8217;d need to log a procedure name and time stamp on create 
  of the logging object.<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">You could have an app 
  server switch to turn logging on and off, so that it&#8217;s not going all the time, 
  but only when indicated from the app server GUI.<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">This may help you 
  find something&#8230;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Dave<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <DIV>
  <DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><FONT 
  face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
  <HR tabIndex=-1 align=center width="100%" SIZE=2>
  </SPAN></FONT></DIV>
  <P class=MsoNormal><B><FONT face=Tahoma size=2><SPAN 
  style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT 
  face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> 
  delphi-bounces@ns3.123.co.nz [mailto:delphi-bounces@ns3.123.co.nz] <B><SPAN 
  style="FONT-WEIGHT: bold">On Behalf Of </SPAN></B>Stacey Verner<BR><B><SPAN 
  style="FONT-WEIGHT: bold">Sent:</SPAN></B> Friday, 2 September 2005 9:48 
  a.m.<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> NZ Borland 
  Developers Group - <st1:place w:st="on">Delphi</st1:place> List<BR><B><SPAN 
  style="FONT-WEIGHT: bold">Subject:</SPAN></B> [DUG] DataSnap/Midas App Server 
  Error</SPAN></FONT><o:p></o:p></P></DIV>
  <P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN 
  style="FONT-SIZE: 12pt"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <DIV>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">We have an DataSnap/Midas app 
  server which fails randomly.</SPAN></FONT><o:p></o:p></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN 
  style="FONT-SIZE: 12pt">&nbsp;<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">We can't make it happen no matter 
  how hard we try, but it happens fairly regularly on our production 
  machine.</SPAN></FONT><o:p></o:p></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN 
  style="FONT-SIZE: 12pt">&nbsp;<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">A little bit of info on the app 
  and app server:</SPAN></FONT><o:p></o:p></P></DIV>
  <UL type=disc>
    <LI class=MsoNormal 
    style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1"><FONT 
    face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">The 
    applicaiton is a normal database application.</SPAN></FONT><o:p></o:p> 
    <LI class=MsoNormal 
    style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1"><FONT 
    face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">The 
    application also needs to get information from&nbsp;a 
    settings&nbsp;(metadata) database such as:</SPAN></FONT><o:p></o:p> 
    <UL type=circle>
      <LI class=MsoNormal 
      style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level2 lfo1"><FONT 
      face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Which 
      databases&nbsp;they have access to</SPAN></FONT><o:p></o:p> 
      <LI class=MsoNormal 
      style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level2 lfo1"><FONT 
      face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">What 
      permissions they have on the database etc</SPAN></FONT><o:p></o:p> 
</LI></UL>
    <LI class=MsoNormal 
    style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1"><FONT 
    face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Instead 
    of connecting directly to the settings database we use the app server which 
    shares one database connection between all clients.</SPAN></FONT><o:p></o:p> 

    <UL type=circle>
      <LI class=MsoNormal 
      style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level2 lfo1"><FONT 
      face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">This 
      means that there is one database connection for each application instead 
      of 2 which reduces licencing costs</SPAN></FONT><o:p></o:p> </LI></UL>
    <LI class=MsoNormal 
    style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level1 lfo1"><FONT 
    face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">We use 
    the borland socket server and a socket connection to connect to the app 
    server.</SPAN></FONT><o:p></o:p> 
    <UL type=circle>
      <LI class=MsoNormal 
      style="mso-margin-top-alt: auto; mso-margin-bottom-alt: auto; mso-list: l0 level2 lfo1"><FONT 
      face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">When 
      we used a normal DCOM connection each client got its own copy of the app 
      server, so the settings database connection is not shared and in effect 
      each&nbsp;application&nbsp;had two connections to the 
      database.</SPAN></FONT><o:p></o:p> </LI></UL></LI></UL>
  <DIV>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Sometimes the app server locks up 
  and the clients can't connect.</SPAN></FONT><o:p></o:p></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN 
  style="FONT-SIZE: 12pt">&nbsp;<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">We have a work around that will 
  try app servers on other machines if this fails which works OK, but if it 
  never gets a connection the all sorts of odd things 
  happen.</SPAN></FONT><o:p></o:p></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN 
  style="FONT-SIZE: 12pt">&nbsp;<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Firstly, does anyone have any 
  thoughts on this. Debug ideas etc?</SPAN></FONT><o:p></o:p></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Secondly, when&nbsp;the connection 
  to the app server fails it takes forever (minutes) to return no matter what I 
  set the socket connection timeout to.</SPAN></FONT><o:p></o:p></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN 
  style="FONT-SIZE: 12pt">&nbsp;<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Thanks</SPAN></FONT><o:p></o:p></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN 
  style="FONT-SIZE: 12pt">&nbsp;<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Arial size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Stacey</SPAN></FONT><o:p></o:p></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN 
  style="FONT-SIZE: 12pt">&nbsp;<o:p></o:p></SPAN></FONT></P></DIV>
  <P class=MsoNormal><FONT face="Courier New" size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">Stacey 
  Verner&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  Ph:&nbsp;&nbsp; +64-9-4154790<BR>Software 
  Developer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Fax:&nbsp; 
  +64-9-4154791<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  DDI:&nbsp; +64-9-4154797<BR>CJN Technologies Ltd.&nbsp;&nbsp;&nbsp;&nbsp; 
  Email: </SPAN></FONT><A href="mailto:stacey@cjntech.co.nz"><FONT 
  face="Courier New" size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">stacey@cjntech.co.nz</SPAN></FONT></A><BR><st1:Street 
  w:st="on"><st1:address w:st="on"><FONT face="Courier New" size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">PO Box 302-278, 
  North</SPAN></FONT></st1:address></st1:Street><FONT face="Courier New" 
  size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> Harbour, 
  <st1:City w:st="on">Auckland</st1:City> 1330, <st1:country-region 
  w:st="on"><st1:place w:st="on">New 
  Zealand</st1:place></st1:country-region><BR><st1:Street w:st="on"><st1:address 
  w:st="on">12 Piermark Drive, North</st1:address></st1:Street> Harbour, 
  <st1:place w:st="on"><st1:City w:st="on">Auckland</st1:City>, 
  <st1:country-region w:st="on">New 
  Zealand</st1:country-region></st1:place><BR>Visit our website at 
  </SPAN></FONT><A href="http://www.cjntech.co.nz/"><FONT face="Courier New" 
  size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">http://www.cjntech.co.nz/</SPAN></FONT></A><FONT 
  face="Courier New" size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> 
  </SPAN></FONT><o:p></o:p></P>
  <DIV>
  <P class=MsoNormal><FONT face="Times New Roman" size=3><SPAN 
  style="FONT-SIZE: 12pt">&nbsp;<o:p></o:p></SPAN></FONT></P></DIV></DIV></BLOCKQUOTE></BODY></HTML>