2016-11-20 10 views
0

Ich habe eine ASP.NET-Anwendung, die auf AWS Elastic Beanstalk ausgeführt wird. Die Website wird ordnungsgemäß ausgeführt, aber ich habe Probleme beim Konfigurieren des AWS-Endprotokolls, um die log4net-Protokolldatei abzurufen.AWS Elastic Beanstalk-Instanz protokolliert mit ASP.NET

Ich verwende log4net, um Protokolle wie folgt in eine Datei auszugeben.

<appender name="RollingFile" type="log4net.Appender.RollingFileAppender"> 
    <file value="C:\testlog.log" /> 
    <appendToFile value="true" /> 
    <maximumFileSize value="5MB" /> 
    <maxSizeRollBackups value="2" /> 
    <layout type="log4net.Layout.PatternLayout"> 
    <conversionPattern value="%date %level %thread %logger - %message%newline" /> 
    </layout> 
</appender> 

ich .ebextensions\testlog.config in meinem Projekt erstellt haben (wie here beschrieben) und haben es in die Ausgabe kopiert (Ich habe festgestellt, dass AWS die Datei in der Konsole Ereignisprotokoll AWS erstellt).

files: 
    "c:/Program Files/Amazon/ElasticBeanstalk/config/taillogs.d/testlog.conf" : 
    content: | 
     C:\testlog.log 

Wenn ich versuche, die Protokolle zu bekommen (Logs -> Anfrage Logs -> Letzte 100 Zeilen -> Download), sehe ich diesen Fehler:

Faulting application path: c:\Program Files\Amazon\ElasticBeanstalk\Tools\TailLogs.exe 
Faulting module path: C:\Windows\SYSTEM32\KERNELBASE.dll 
Report Id: df345c3f-af75-11e6-8155-06f0078a1fb7 
Faulting package full name: 
Faulting package-relative application ID: 
2016-11-20T23:05:48.000Z Error 0:(0) .NET Runtime - Application: TailLogs.exe 
Framework Version: v4.0.30319 
Description: The process was terminated due to an unhandled exception. 
Exception Info: System.ArgumentException 
    at System.IO.Path.LegacyNormalizePath(System.String, Boolean, Int32, Boolean) 
    at System.IO.Path.NormalizePath(System.String, Boolean, Int32, Boolean) 
    at System.IO.Path.GetFullPathInternal(System.String) 
    at System.IO.DirectoryInfo.Init(System.String, Boolean) 
    at System.IO.DirectoryInfo..ctor(System.String) 
    at AWSBeanstalkCfnUtility.LogInfo.GetLogFiles(System.String) 
    at AWSBeanstalkCfnUtility.FileUtil.scanLogDirectories(System.IO.TextWriter, System.Collections.Generic.IEnumerable`1<AWSBeanstalkCfnUtility.LogInfo>) 
    at AWSBeanstalkCfnTailLogsApp.Program.Main(System.String[]) 

Ich habe versucht, auf verschiedene Dateiprotokollierung Pfade (C:\inetpub\logs\, C:\Program Files\Amazon\ElasticBeanstalk\logs\), aber ich bekomme immer den gleichen Fehler.

Irgendwelche Ideen, was ich falsch mache?

Antwort

0

Ich habe die Ursache des Problems gefunden, ich musste Schreibberechtigungen für den Ordner festlegen, in den das Protokoll ging.

container_commands: 
    01-changeperm: 
    command: icacls.exe c:\\inetpub\\logs /grant "IIS AppPool\DefaultAppPool":(OI)(CI)M > c:\\cfn\\perms.log 2>&1 
    waitAfterCompletion: 0 

files: 
    "c:/Program Files/Amazon/ElasticBeanstalk/config/taillogs.d/applog.conf": 
    content: | 
     C:\inetpub\logs\app.log 
Verwandte Themen