<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ServerLogger - Multi-threading in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451748#M17518</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I haven't used the ArcGIS Runtime yet but have been using both Silverlight 5 as well as pure Windows applications which consume ArcGIS Server services (including SOE REST extensions).&amp;nbsp; I use the task framework which is really nice.&amp;nbsp; In fact, there are a lot of nice things that you can do with the Microsoft framework when you are not bound by all the rules that ArcObjects impose you on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately, I still have alot of ArcObjects code which runs in ArcMap and ArcGIS Server.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Mar 2013 23:38:05 GMT</pubDate>
    <dc:creator>RichardWatson</dc:creator>
    <dc:date>2013-03-05T23:38:05Z</dc:date>
    <item>
      <title>ServerLogger - Multi-threading</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451742#M17512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a Server Object Extension which uses threads from the thread pool.&amp;nbsp; Threads from the thread pool are, by definition, COM MTA.&amp;nbsp; When I try to log messages from an MTA thread then I find that I get various exceptions related to the RCW.&amp;nbsp; I know that ArcObjects are COM STA and that they do not deal well with MTA threads.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Just wondering if anyone has an suggestions, other than not using the thread pool, here?&amp;nbsp; What I've done is to wrap the ServerLogger in a class which simply does not log messages unless the request comes from thread that created the class, i.e. the main thread.&amp;nbsp; This stop the crashes but also causes me to lose valuable messages.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I really wish is that the ServerLogger was able to support MTA threads.&amp;nbsp; I am not asking for all ArcObjects (that is not going to happen) but rather just the logging system.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 12:53:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451742#M17512</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2013-03-04T12:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: ServerLogger - Multi-threading</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451743#M17513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;can be help you (&lt;/SPAN&gt;&lt;STRONG&gt;Using managed ThreadPool and BackGroundWorker threads&lt;/STRONG&gt;&lt;SPAN&gt; ) : &lt;/SPAN&gt;&lt;A href="http://resources.esri.com/help/9.3/arcgisengine/dotnet/2c2d2655-a208-4902-bf4d-b37a1de120de.htm"&gt;http://resources.esri.com/help/9.3/arcgisengine/dotnet/2c2d2655-a208-4902-bf4d-b37a1de120de.htm&lt;/A&gt;&lt;SPAN&gt; ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 13:29:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451743#M17513</guid>
      <dc:creator>nicogis</dc:creator>
      <dc:date>2013-03-04T13:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: ServerLogger - Multi-threading</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451744#M17514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have seen that article.&amp;nbsp; Essentially, what ESRI advises is to not use thread pool threads.&amp;nbsp; The problem with that is that there are many nice classes from Microsoft which use it, e.g. the Task framework.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 14:14:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451744#M17514</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2013-03-04T14:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: ServerLogger - Multi-threading</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451745#M17515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;have you seen &lt;/SPAN&gt;&lt;A href="http://blogs.msdn.com/b/pfxteam/archive/2010/04/07/9990421.aspx"&gt;http://blogs.msdn.com/b/pfxteam/archive/2010/04/07/9990421.aspx&lt;/A&gt;&lt;SPAN&gt; ( ParallelExtensionsExtras ) ?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 17:17:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451745#M17515</guid>
      <dc:creator>nicogis</dc:creator>
      <dc:date>2013-03-04T17:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: ServerLogger - Multi-threading</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451746#M17516</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the post.&amp;nbsp; I had seen this before but it is adding yet another unsupported library to my project:(&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think that I am going to restructure my code so that I don't touch any ArcObjects in my thread pool thread.&amp;nbsp; I'll wait to do that when the thread completes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I really want is for ESRI to address this because their current approach makes it difficult to leverage the goodness of .NET.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 23:14:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451746#M17516</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2013-03-04T23:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: ServerLogger - Multi-threading</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451747#M17517</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For now I'm using framework 4.5 only arcgis runtime wpf ... ( in my blog I have posted a sample call soe using arcgis runtime wpf: &lt;/SPAN&gt;&lt;A href="http://nicogis.blogspot.it/2013/02/alziamo-il-livello-3d-surface.html"&gt;http://nicogis.blogspot.it/2013/02/alziamo-il-livello-3d-surface.html&lt;/A&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2013 07:57:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451747#M17517</guid>
      <dc:creator>nicogis</dc:creator>
      <dc:date>2013-03-05T07:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: ServerLogger - Multi-threading</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451748#M17518</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I haven't used the ArcGIS Runtime yet but have been using both Silverlight 5 as well as pure Windows applications which consume ArcGIS Server services (including SOE REST extensions).&amp;nbsp; I use the task framework which is really nice.&amp;nbsp; In fact, there are a lot of nice things that you can do with the Microsoft framework when you are not bound by all the rules that ArcObjects impose you on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Unfortunately, I still have alot of ArcObjects code which runs in ArcMap and ArcGIS Server.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Mar 2013 23:38:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451748#M17518</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2013-03-05T23:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: ServerLogger - Multi-threading</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451749#M17519</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What if you maintained a collection of backgroundworkers, and when a request comes in, hand it off to the first worker that's not busy?&amp;nbsp; Logging from the worker (MTA) thread would be reported via &lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/a3zbdb1t.aspx"&gt;ReportProgress&lt;/A&gt;&lt;SPAN&gt;. Th STAThread would write to the ServerLogger when the &lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.progresschanged.aspx"&gt;ProgressChanged event&lt;/A&gt;&lt;SPAN&gt; fires.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit:&amp;nbsp; On further thought though, doesn't arcgis server already do this when it decides which ArcSoc process to hand the request off to?&amp;nbsp; In other words, it should know if a mapservice's SOE is busy, and hand the request to one that's not busy, and even wait until one is not busy.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Mar 2013 01:30:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451749#M17519</guid>
      <dc:creator>KirkKuykendall</dc:creator>
      <dc:date>2013-03-06T01:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: ServerLogger - Multi-threading</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451750#M17520</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the suggestion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What I did was to refactor my code so that I had a class which touched no ArcObjects.&amp;nbsp; The code used to log warnings (using the ServerLogger) as it ran but I modified it to simply collect this information.&amp;nbsp; The STA thread which gets the result from the MTA task then logs a summary of all the warnings which occurred, if any.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The thing that I really hate about all of this is having to work around the limitations of ArcObjects.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also interesting is that I logged an issue with ESRI support with regards the sort order of messages in Server Manager being wrong when you rapidly log messages.&amp;nbsp; I created a trivial SOE which logged 100 messages in a for loop: "Message 1", "Message 2", etc..&amp;nbsp; If you sort the server log in reverse order of time then it jumbles the order.&amp;nbsp; What happens is that chunks of the messages have the same time stamp.&amp;nbsp; What the code should do is to preserve (or reverse) the order in the file when the timestamps are the same.&amp;nbsp; Interesting boundary condition.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Mar 2013 20:26:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451750#M17520</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2013-03-06T20:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: ServerLogger - Multi-threading</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451751#M17521</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yes, I've also seen some strange things with logging.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On a multimachine site, if I went into ArcGIS Server Manager and pushed the clear log button, I'd get an error saying it could not complete, or something like that.&amp;nbsp; Haven't tried it lately. Will try again and post results.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I suspect root cause is that the logger is busy logging a "clearing log" message at the same time it is trying to clear the log.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is ServerLogger a singleton? If so, did you try using Activator.CreateInstance on the background thread instead of "new"?&amp;nbsp; (as prescribed by the threads-in-isolation pattern).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From what you describe, it sounds like we should be including our own timestamp in the body of the message.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In general I find SOE's quick and easy, but I can't help but wonder if there are cases where it might make more sense to write a WCF Rest service that uses arcobjects.&amp;nbsp; These are normally MTAThreaded, but I've read about making it STAThreaded, like &lt;/SPAN&gt;&lt;A href="http://stackoverflow.com/questions/3880516/how-are-sta-com-components-handled-when-used-in-a-wcf-service-hosted-in-iis-7"&gt;here&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Mar 2013 02:04:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451751#M17521</guid>
      <dc:creator>KirkKuykendall</dc:creator>
      <dc:date>2013-03-07T02:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: ServerLogger - Multi-threading</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451752#M17522</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have also seen similar errors which regards to clearing the log on a site with a single machine.&amp;nbsp; Next week, I am hoping to do some testing with a site that has multiple machines.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I filed a NIMBUS on the time stamp issue.&amp;nbsp; ESRI just needs to implement a stable sort algorithm to solve this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think that there are a lot of users who just use ArcObjects from their web service and avoid using ArcGIS Server at all.&amp;nbsp; You see it all the time in the forums posts because many struggle with binding and licensing in this situation.&amp;nbsp; The various design choices are about trade-offs.&amp;nbsp; For example, if you use ArcObjects directly then you gain simplicity but you lose scalability.&amp;nbsp; I suspect that you someone has a list with the all the trade-offs.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Mar 2013 10:49:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/serverlogger-multi-threading/m-p/451752#M17522</guid>
      <dc:creator>RichardWatson</dc:creator>
      <dc:date>2013-03-09T10:49:58Z</dc:date>
    </item>
  </channel>
</rss>

