首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >企业库5日志块抛出SynchronizationLockException

企业库5日志块抛出SynchronizationLockException
EN

Stack Overflow用户
提问于 2010-10-27 16:27:45
回答 1查看 2.8K关注 0票数 2

Global.asax.cs内部,get:对象同步方法是从不同步的代码块调用的。

代码语言:javascript
复制
protected void Application_Start()
    {
        InitContainer();

        AreaRegistration.RegisterAllAreas();

        RegisterRoutes(RouteTable.Routes);

        ControllerBuilder.Current.SetControllerFactory(typeof(UnityControllerFactory));
        CheckForAndMinify();
        Logger.Write("test"); //exception
       // if (System.Diagnostics.Debugger.IsAttached)
           // MvcContrib.Routing.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);
        //RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes);

    }

环境:

Mvc2

  • VS2010

  • Windows7企业64位

  • 统一框架在此日志记录代码

之前启动

相关的web.config条目:

代码语言:javascript
复制
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true"/>

代码语言:javascript
复制
    <loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
    <listeners>
        <add name="GeneralRolling" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" fileName="~\App_Data\rolling2.log" formatter="Text Formatter" rollInterval="Day" rollSizeKB="2056" maxArchivedFiles="2" filter="Warning"/>
        <add name="EspionageRolling" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" fileName="~\App_Data\EspRolling.log" formatter="Text Formatter" rollInterval="Day" rollSizeKB="1024" maxArchivedFiles="2" traceOutputOptions="DateTime"/>
        <add name="SnapshotRolling" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" fileName="~\App_Data\SnapRolling.log" formatter="Text Formatter" rollInterval="Day" rollSizeKB="1024" maxArchivedFiles="2" traceOutputOptions="DateTime"/>
    </listeners>
    <formatters>
        <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" template="Title:{title}{newline}&#xA;Category: {category}{newline}&#xA;Message: {message}{newline}&#xA;Timestamp: {timestamp}{newline}&#xA;Priority: {priority}{newline}&#xA;EventId: {eventid}{newline}&#xA;Severity: {severity}{newline}&#xA;Machine: {localMachine}{newline}&#xA;App Domain: {localAppDomain}{newline}&#xA;ProcessId: {localProcessId}{newline}&#xA;Process Name: {localProcessName}{newline}&#xA;Thread Name: {threadName}{newline}&#xA;Win32 ThreadId:{win32ThreadId}{newline}&#xA;Extended Properties: {dictionary({key} - {value}{newline})}" name="Text Formatter"/>
    </formatters>
    <categorySources>
        <add switchValue="All" name="General">
            <listeners>
                <add name="GeneralRolling"/>
            </listeners>
        </add>
        <add switchValue="All" name="Espionage">
            <listeners>
                <add name="EspionageRolling"/>
            </listeners>
        </add>
        <add switchValue="All" name="SnapShot">
            <listeners>
                <add name="SnapshotRolling"/>
            </listeners>
        </add>
    </categorySources>
    <specialSources>
        <allEvents switchValue="All" name="All Events">
            <listeners>
                <add name="GeneralRolling"/>
            </listeners>
        </allEvents>
        <notProcessed switchValue="All" name="Unprocessed Category"/>
        <errors switchValue="All" name="Logging Errors &amp; Warnings">
            <listeners>
                <add name="GeneralRolling"/>
            </listeners>
        </errors>
    </specialSources>
</loggingConfiguration>

我试图确保记录器在应用程序启动时工作,这样应用程序就不会启动,看起来正确,然后在第一次尝试记录某件事情发生时就会死掉。

日志xml配置没有改变,它以前是工作的。主要的改变是添加了Unity,并将应用程序从linq切换到sql。我还没有确认此代码是否在部署环境中工作,因此它可能出于某种原因在适当的环境中工作,而不是在本地。

EN

回答 1

Stack Overflow用户

发布于 2011-02-23 03:51:51

如果您在Visual之外运行该应用程序,它会崩溃吗?你所看到的是与团结有关的问题,以及它是如何创造单身者的。如果将vs设置为只显示未处理的用户异常,那么就不会再看到它了。我刚才也有同样的问题。是弱智。我在企业图书馆4中没有看到这个,只是在5中。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4035437

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档