IronPDF 에서 AWS 로그 파일 문제 해결
S3 버킷을 사용하여 IronPDF 로그 격리
AWS 환경에서 IronPDF 관련 문제를 해결할 때 IronPDF 라이브러리 자체에서 생성되는 깨끗하고 독립적인 로그를 확보하는 것이 매우 유용합니다. 이러한 접근 방식은 Amazon CloudWatch Logs 또는 AWS Application Insights와 같은 서비스에서 병합된 로그 스트림을 분석하는 복잡성을 피하는 데 도움이 됩니다.
CloudWatch Logs 및 Application Insights와 같은 서비스는 일반적으로 애플리케이션 코드, 다른 라이브러리 및 AWS 서비스를 포함한 다양한 소스의 로그를 집계합니다. 이러한 뒤섞임 현상으로 인해 IronPDF 관련 메시지를 정확히 찾아내고 PDF 생성 또는 조작과 관련된 문제를 직접 진단하기가 어려워질 수 있습니다.
이러한 문제를 해결하기 위해 IronPDF AWS 컴퓨팅 환경의 임시 저장소 내의 전용 파일에 로그를 기록하도록 구성하는 것이 좋습니다. 이렇게 분리된 로그 파일은 아마존 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"
로그 파일을 아마존 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
AWS 특정 로깅 서비스에 대한 자세한 내용은 다음 문서를 참조하십시오.
아마존 클라우드워치
Amazon CloudWatch Logs 서비스를 사용하면 리소스, 애플리케이션 및 서비스에서 로그를 거의 실시간으로 수집하고 저장할 수 있습니다.
추가 로깅
Amazon CloudWatch 로그, Amazon S3 로그 및 Kinesis Data Firehose로 전송되는 로그에 대한 자세한 내용은 다음을 참조하십시오.
https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html
공용 서비스
AWS 람다
https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html
아마존 EC2
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Install-CloudWatch-Agent.html

