IronPDF 故障排除 AWS日志文件 Troubleshooting AWS Log Files in IronPDF Curtis Chau 已更新:六月 11, 2025 Download IronPDF NuGet 下载 DLL 下载 Windows 安装程序 Start Free Trial Copy for LLMs Copy for LLMs Copy page as Markdown for LLMs Open in ChatGPT Ask ChatGPT about this page Open in Gemini Ask Gemini about this page Open in Grok Ask Grok about this page Open in Perplexity Ask Perplexity about this page Share Share on Facebook Share on X (Twitter) Share on LinkedIn Copy URL Email article This article was translated from English: Does it need improvement? Translated View the article in English 使用S3存储桶隔离IronPDF日志 在AWS环境中排除IronPDF问题时,获得来自IronPDF库的干净、专用日志非常有益。 这种方法有助于避免从Amazon CloudWatch Logs或AWS Application Insights等服务合并日志流中筛选的复杂性。 CloudWatch Logs和Application Insights等服务通常会汇总来自各种来源的日志,包括您的应用程序代码、其他库和AWS服务。 这种交错可能使得很难直接定位IronPDF特定的消息并诊断与PDF生成或操作相关的问题。 为了解决这些挑战,我们建议配置IronPDF将其日志写入AWS计算环境的临时存储中的专用文件。 然后可以轻松将此隔离的日志文件上传到Amazon S3存储桶,以便需要时便捷地下载、查看和与支持共享。 启用和配置IronPDF日志记录 var awsTmpPath = @"/tmp/"; IronSoftware.Logger.LoggingMode = IronSoftware.Logger.LoggingModes.All; IronSoftware.Logger.LogFilePath = awsTmpPath + "default.txt"; var awsTmpPath = @"/tmp/"; IronSoftware.Logger.LoggingMode = IronSoftware.Logger.LoggingModes.All; IronSoftware.Logger.LogFilePath = awsTmpPath + "default.txt"; Dim awsTmpPath = "/tmp/" IronSoftware.Logger.LoggingMode = IronSoftware.Logger.LoggingModes.All IronSoftware.Logger.LogFilePath = awsTmpPath & "default.txt" $vbLabelText $csharpLabel 将日志文件上传到Amazon S3存储桶 // File path in the Lambda /tmp directory var filePath = $"/tmp/default.txt"; // Read the file as byte array var fileBytes = await File.ReadAllBytesAsync(filePath); // Upload the text file to S3 using (var memoryStream = new MemoryStream(fileBytes)) { var request = new PutObjectRequest { BucketName = bucketName, Key = "default.txt", InputStream = memoryStream, ContentType = "text/plain", }; await _s3Client.PutObjectAsync(request); } // File path in the Lambda /tmp directory var filePath = $"/tmp/default.txt"; // Read the file as byte array var fileBytes = await File.ReadAllBytesAsync(filePath); // Upload the text file to S3 using (var memoryStream = new MemoryStream(fileBytes)) { var request = new PutObjectRequest { BucketName = bucketName, Key = "default.txt", InputStream = memoryStream, ContentType = "text/plain", }; await _s3Client.PutObjectAsync(request); } ' File path in the Lambda /tmp directory Dim filePath = $"/tmp/default.txt" ' Read the file as byte array Dim fileBytes = Await File.ReadAllBytesAsync(filePath) ' Upload the text file to S3 Using memoryStream As New MemoryStream(fileBytes) Dim request = New PutObjectRequest With { .BucketName = bucketName, .Key = "default.txt", .InputStream = memoryStream, .ContentType = "text/plain" } Await _s3Client.PutObjectAsync(request) End Using $vbLabelText $csharpLabel 对于AWS特定的日志记录服务,请参阅以下文档: Amazon CloudWatch Amazon CloudWatch Logs服务允许您几乎实时地从您的资源、应用程序和服务中收集和存储日志。 https://aws.amazon.com/cloudwatch/ https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/WhatIsCloudWatchLogs.html https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/aws-services-sending-logs.html 附加日志记录 关于Amazon CloudWatch Logs、Amazon S3 Logs以及发送到Kinesis Data Firehose的日志的更多信息,请参见: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html 常见服务 AWS Lambda https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html Amazon EC2 https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html Curtis Chau 立即与工程团队聊天 技术作家 Curtis Chau 拥有卡尔顿大学的计算机科学学士学位,专注于前端开发,精通 Node.js、TypeScript、JavaScript 和 React。他热衷于打造直观且美观的用户界面,喜欢使用现代框架并创建结构良好、视觉吸引力强的手册。除了开发之外,Curtis 对物联网 (IoT) 有浓厚的兴趣,探索将硬件和软件集成的新方法。在空闲时间,他喜欢玩游戏和构建 Discord 机器人,将他对技术的热爱与创造力相结合。 准备开始了吗? Nuget 下载 16,154,058 | 版本: 2025.11 刚刚发布 免费 NuGet 下载 总下载量:16,154,058 查看许可证